Reputation: 818
I really am unable to add a directory to the $PATH
variable. I have tried to add a text file to etc/paths.d/
containing the path I want to add, but the OS refuses to let me add a file to that directory (permission denied). I don't know why, since I log in as admin...
Please help me, I need to add the adb
path for the Android SDK on macosx.
Upvotes: 4
Views: 6099
Reputation: 126038
The permissions on /etc/paths.d only allow the root account to write to it, not normal admins. This is actually fairly common in OS X, since many users operate day-to-day as admins, but for security reasons it's a bad idea for them to have write access to any settings that can influence system integrity without going through an explicit I-mean-to-do-that step.
So how can you add a file? In general, you need to use a process that promotes to root to do the operation. I'll give three examples:
sudo
as a prefix to run a command as root (again, after entering your admin password), e.g. sudo cp mypathfile /etc/paths.d
or sudo vi /etc/paths.d/mypathfile
.Upvotes: 4