Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

KevMA

macrumors newbie
Original poster
Nov 24, 2017
6
1
I'm making changes to increase my productivity, by decreasing browsing/usage of time-wasting websites and apps. I know how to remove access to websites via Terminal, which works well. However, I would like to do the same to temporarily block access to applications.

Does anyone know how to do this?
 
Which apps did you want to block? On which OS version?

If you want to block any apps that are part of the default OS install, you might run into restrictions imposed by System Integrity Protection (SIP). If SIP is disabled, or you're running an OS without it, it's pretty easy.

One way to disable an app is to remove execute permission from the main executable inside the app bundle. If you do that, then the app can't run. You might get a failure dialog in Finder if you try to run it, or Finder might show a "slashed circle" imprint on the app's icon. It kinda depends on the OS version.

To restore the app, you re-enable execute permissions on the app's main executable.

If the app is owned by root (default for Apple-supplied apps), then you'll also need the 'sudo' command.

You can even put the removal of execute permissions into a Run Shell Script action in Automator, save the result as an app, and then use that app to disable other apps. You would then put the re-enabling of execute permissions into another Automator app, and you can drag and drop apps to enable/disable them.

The command-line tool that changes permissions is called 'chmod'. The name of the permission is 'x'. You probably want the 'a' attribute, so it applies to owner, group, and other mode-bits.

If you need specific details of the exact command-line, ask again and I'll go into it with a specific example. If you're already familiar with chmod, or can search for info on the web, then you should have enough to go on.
 
Last edited:
  • Like
Reactions: Fitty5
Thanks, chown. I've been pushing myself to be more disciplined this past week, as well as using the Terminal blocks for websites I waist the most time on (so I might not need the chmod setup you mentioned, but will keep it in mind). It seems like stopping the compulsive web browsing is drastically reducing compulsive app usage at the same time, which is a good surprise. :)
 
Which apps did you want to block? On which OS version?

If you want to block any apps that are part of the default OS install, you might run into restrictions imposed by System Integrity Protection (SIP). If SIP is disabled, or you're running an OS without it, it's pretty easy.

One way to disable an app is to remove execute permission from the main executable inside the app bundle. If you do that, then the app can't run. You might get a failure dialog in Finder if you try to run it, or Finder might show a "slashed circle" imprint on the app's icon. It kinda depends on the OS version.

To restore the app, you re-enable execute permissions on the app's main executable.

If the app is owned by root (default for Apple-supplied apps), then you'll also need the 'sudo' command.

You can even put the removal of execute permissions into a Run Shell Script action in Automator, save the result as an app, and then use that app to disable other apps. You would then put the re-enabling of execute permissions into another Automator app, and you can drag and drop apps to enable/disable them.

The command-line tool that changes permissions is called 'chmod'. The name of the permission is 'x'. You probably want the 'a' attribute, so it applies to owner, group, and other mode-bits.

If you need specific details of the exact command-line, ask again and I'll go into it with a specific example. If you're already familiar with chmod, or can search for info on the web, then you should have enough to go on.
I'm looking to block apps on my Macbook using Terminal. Could you break down the specific command-lines I would need to use? Thank you!
 
I’ve tested Santa in macOS 15.2 and it works.
Download latest dmg, santa-2024.9.dmg at the moment https://github.com/google/santa/releases/latest
Open the dmg and install santa-2024.9.pkg
When asked, authorize the Santa endpoint security extension (System Settings – General – Login Items & Extensions - Endpoint Security Extensions).
In System Settings – Privacy & Security – Full Disk Access authorize com.google.santa.daemon.
To block the Keychain Access.app, from Terminal run:

Code:
sudo santactl rule --block --path /System/Library/CoreServices/Applications/Keychain\ Access.app

To unblock the Keychain Access.app, from Terminal run:
Code:
sudo santactl rule --remove --path /System/Library/CoreServices/Applications/Keychain\ Access.app

Both commands require administrator password.
 
  • Like
Reactions: Fitty5
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.