Terminal Operation not Permitted - Rootless?

MattZani

macrumors 68030
Original poster
Apr 20, 2008
2,552
103
UK
In Yosemite I had renamed the Photos app so that it wouldn't launch, ever. It was a huge PITA for my workflow. El Cap has renamed it again so it works, but the command I used last time is blocked, assuming it's part of Rootless, is there an easy work around?

The command is this:

Code:
sudo mv /Applications/Photos.app/Contents/MacOS/{,_}Photos
 

KALLT

macrumors 603
Sep 23, 2008
5,141
3,189
Not without circumventing SIP/rootless. Either you turn it off or you try renaming the application from a Terminal on a different system (also works from Recovery).
 

MattZani

macrumors 68030
Original poster
Apr 20, 2008
2,552
103
UK
So I could run the rename command in recovery, without having to fully disabling Rootless?
 

KALLT

macrumors 603
Sep 23, 2008
5,141
3,189
So I could run the rename command in recovery, without having to fully disabling Rootless?
Yes. The kernel prevents you from doing that, so you have to do it from the outside. If your disk is encrypted then you have to unlock it first. Note that you are running as root in Recovery, so be careful.
 

MattZani

macrumors 68030
Original poster
Apr 20, 2008
2,552
103
UK
I assume the command isn't exactly the same, as it doesn't assume it has to run in my user?
 

KALLT

macrumors 603
Sep 23, 2008
5,141
3,189
I assume the command isn't exactly the same, as it doesn't assume it has to run in my user?
You don’t have to prepend the sudo command. The rest is the same. You just need to make sure that you access the right directory. The root directory is not “/” here, because you are not working from Macintosh HD, but Recovery HD. So using /Applications won’t work. Instead you have to change the working directory first and then use a relative path (without a “/” before Applications).

In this case, assuming that your volume is indeed Macintosh HD:
Code:
cd /Volumes/Macintosh\ HD
This changes your working directory. Use the pwd command to verify this (it will show you the full directory you are currently using). You can also use the ls command to list the folders in that directory (which should be: Applications, Library, Users and System, among others).

Then you use this command (without the “/” before Applications):
Code:
mv Applications/Photos.app/Contents/MacOS/{,_}Photos
Honestly though, if you are not used to such operations with the Terminal then please don’t try this. Just disable SIP temporarily, move the application and turn it on again.
 
Last edited:
  • Like
Reactions: Weaselboy

dsemf

macrumors 6502
Jul 26, 2014
375
83
In Yosemite I had renamed the Photos app so that it wouldn't launch, ever. It was a huge PITA for my workflow. El Cap has renamed it again so it works, but the command I used last time is blocked, assuming it's part of Rootless, is there an easy work around?

The command is this:

Code:
sudo mv /Applications/Photos.app/Contents/MacOS/{,_}Photos
Or you could just tell Utilities / Image Capture to not start Photos.

Mount photo source device. Open Image Capture. Change action in the lower left corner.

DS
 

MattZani

macrumors 68030
Original poster
Apr 20, 2008
2,552
103
UK
Honestly though, if you are not used to such operations with the Terminal then please don’t try this. Just disable SIP temporarily, move the application and turn it on again.
Okay thanks, I thought it would be easier just to do it without disabling SIP but probably not by looking at it. Thanks for your help and detailed response though.

Or you could just tell Utilities / Image Capture to not start Photos.

Mount photo source device. Open Image Capture. Change action in the lower left corner.

DS
This doesn't work when you've formatted the device, something I do after every import. It's infuriating there isn't an option to actually disable this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.