Reputation: 33
I've looked all over Stack Overflow and everyone's had their problem solved. I just can't get any of the solutions to work on my Mac.
I've tried sudo mkdir /usr/local/bin
, sudo mkdir -p /usr/local/bin
, and my terminal says:
mkdir: /usr/local: No such file or directory
mkdir: /usr/local/bin: Operation not permitted
When I cd /usr
, and ls
it shows me these files:
X11
adic
lib
sbin
standalone
X11R6
bin
libexec
share
Was there supposed to be a local
folder inside the usr
folder?
Either way, I can't create any directories inside the usr
or usr/bin
folders or even use the ls
. Why is this happening? Is there a way to force the terminal to create a directory?
I'm also new and trying to get the grasp of how Terminal really works...
Upvotes: 3
Views: 1238
Reputation: 31
I had similar problems and all attempts at creating, removing and recreating the symlink didn't work even though my $PATH
variable and ~/.bash_profile
content looked as expected. What eventually worked for me was to remove the space from the actual Sublime installation directory (/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl
) and running the symlink creation as
$ ln -s /Applications/SublimeText.app/Contents/SharedSupport/bin/subl ~/bin/subl
Upvotes: 0
Reputation: 56538
If /usr/local
doesn't exist, trying to create /usr/local/bin
will fail because there is nowhere to put it. You can either create /usr/local
first, or use the -p
flag to mkdir, which will create any missing directories in the path automatically.
mkdir -p /usr/local/bin
The answer pointing to El Capitan's rootless mode is not correct. Four locations are not restricted by rootless mode.
/usr/local
/Applications
/Library
~/Library
Upvotes: 1
Reputation: 102852
I haven't upgraded to El Capitán, partially for this reason, but putting the subl
symlink in ~/bin
will work for any version of OS X. First, though, I strongly recommend using Sublime Text 3. Even though it's called "beta", it's rock solid and has many feature additions, improvements, and bug fixes over ST2. I've been using it exclusively for over 2 years now, and I wouldn't dream of going back.
In your home directory, create a bin
directory ($
is the terminal prompt, don't type it):
$ cd
$ mkdir bin
Create the symlink. If you use ST3, this is the proper command. Otherwise, add \ 2
between Text
and .app
:
$ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/bin/subl
Either open or create ~/.profile
or ~/.bashrc
(if you already have one, use that. Otherwise, use .profile
):
$ bin/subl .profile
Add the following to it (it really doesn't matter where in the file you put it):
export PATH=$HOME/bin:$PATH
Save the file, restart your Terminal session, and the subl
command should now be available.
Based on your comments, I suspect that Sublime Text.app
may actually be in your /Users/username/Applications
directory instead of /Applications
. Try running the following commands to test this:
$ cd
$ rm bin/subl
$ ln -s /Users/username/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl $HOME/bin/subl
# where username is your actual user name
$ bin/subl .bashrc
If Sublime opens with either an actual .bashrc
or an empty file, then you're good to go — you can add the export PATH=...
command as above and save the file. Keep in mind that the path for the ln
command is assuming you're using Sublime Text 3, as recommended.
Upvotes: 5
Reputation: 1740
This is because of El Capitan's new rootless system: basically root can't access system directories anymore.
To disable this, follow this: Disabling rootless mode on El Capitan
Upvotes: -1