9
votes

The system is a Mac OS X El Capitan running Sublime Text 3.

I was perfectly able to run ST3 from the terminal, using the symbolic link by typing "subl". I have no idea what could have possibly changed.

Now everytime I try to start subl from the terminal in any given directory (by running "subl .") I get a "Permission Denied" window every 5 seconds.

[Sublime opens the specified directory, whichever it is, and then everytime I switch back to ST3, the window pops up "Permission Denied"]

The only message in ST's console is: "error: Permission denied".

When opening Sublime Text from the GUI (not CLI), this doesn't happen at all.

8
I took this to Sublime Text's Forum: sublimetext.com/forum/viewtopic.php?f=3&t=21987 - Jonathan Soifer
I would use sudo opensnoop, probably filtered with grep, to try to determine if any failed file system requests correspond with the error. - Alexander O'Mara
My solutions was similar to the answer by Gavy, however, one small change fixed my issue. All the steps Gavy mentioned are the same, with the exception of when you're looking at the permissions, you also want to click the settings wheel for your user and make sure to click "apply to enclosed items...." My user already had read and write permissions on the folder, but something got fouled up with our repo and I was no longer able to write with my user to some places inside the main folder. Hope it helps. - Rob Orr

8 Answers

6
votes

If you have installed Git for Sublime 3 it causes an error and popup "Permission Denied" If you deleted any project file or folder that has been hosted in github.

Solution: Delete the Git package and reinstall it. You can do

cmd+shift+p and select "Package Control: Disable Package" and select Git

Hope it helps.

2
votes

Disable csrutil by rebooting in recovery mode (cmd + r on startup) then Utilities > Terminal

csrutil disable

then reboot your mac as you normally would. csrutil should do it but I have heard others supposedly needed to disable gatekeeper as well...

Disable gatekeeper in terminal with:

sudo spctl --master-disable

1
votes

The only way I could find was disabling all the plugins altogether.

This stopped the error message. Now I'm enabling them back, one by one, so far so good.

1
votes
  1. Right click on your main folder.
  2. Get Info
  3. Sharing & Permissions. (Unlock if necessary)
  4. Add a new user and add yourself into the group. Press OK.
  5. Change your Privilege from 'Read only' to 'Read & Write'.
  6. Wait for the changes to be completed and try to save. You should be able to save now.
1
votes

From the GUI, doing File > Save As... and navigating to the folder a second time cleared it for me. I had been reorganizing folders and files in the Finder, opened one, and attempted to do a Save As... when I got the error.

I checked file and folder permissions via File > Get Info, but everything was fine there. Not sure why Sublime Text got confused.

1
votes

Simple solution: While you save the file in sublime Text. It asks for the location. Check if the default location to save is "/" directory. If yes, change the directory location as you don't have permission to create a new file in / folder Note: If Sublime is not asking for the directory, use "Save as" option

0
votes

On my OS X El Capitan, when starting Sublime Text 3 from the app icon, it had issues with the environment PATH. As a result, it found Apple's git at /usr/bin/git and there was no "Permission Denied" every 10 seconds. However, when starting from the command line, from what I've read about Sublime and Paths, I assumed it would use the existing PATH from the bash session and find MY git install located at /usr/local/bin/git. For some reason, it wasn't doing that and must've been using another git or couldn't find any at all.

My Fix:
I edited my Git.sublime-settings (Sublime Text > Preferences > Package Settings > Git > Settings - User) and the Permission Denied popups stopped. I restarted a few times from both the app icon and CLI and it's gone. The Tools > Git commands all work fine and there's no more issue.

Git.sublime-settings file:
{
  "git_command": "/usr/local/bin/git"
}

Use the path to your git install.

0
votes

Run sudo /Applications/Sublime\ Text.app/Contents/MacOS/Sublime\ Text from console. It will open a new Sublime window as root user