10

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.

Jonathan Soifer
  • 2,715
  • 6
  • 27
  • 50
  • I took this to Sublime Text's Forum: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=21987 – Jonathan Soifer Nov 28 '15 at 13:19
  • 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 May 27 '16 at 03:45
  • 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 May 05 '17 at 18:03

8 Answers8

7

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.

Alisher Musurmonv
  • 815
  • 1
  • 9
  • 18
2

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

Arthur
  • 462
  • 3
  • 5
  • I've disabled csrutil from the terminal in recovery mode. That didn't help. I've also disabled gatekeeper (from a regular session). Also didn't work. Any other idea how this could possibly be fixed or why it is happening at all? – Jonathan Soifer Nov 30 '15 at 16:36
  • Hmm, not sure then. Im assuming you could go all the way through the file path and change each folders permissions with: right click > Get info > Sharing & Permissions. I know you can do this manually in terminal quick for all enclosed folders just don't remember the command. – Arthur Nov 30 '15 at 22:45
  • But should I change the permission for the Sublime Text app folders or the folder that I'm trying to open? Not sure this is clear: this happens with whichever folder I try to open using the subl symbolic link. Would that mean I need to do that everytime for every new project? – Jonathan Soifer Nov 30 '15 at 23:11
  • Also, why I seem to be the only person facing this issue? Have you seen someone else with the same problem? Couldn't find any other posts/questions about this. – Jonathan Soifer Nov 30 '15 at 23:11
  • 1
    This is a dangerous suggestion to follow if you don't know what you're doing. Running this will disable System Integrity Protection - a security feature. You shouldn't need to do this. – Dan2552 Apr 27 '17 at 09:32
1

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.

Jonathan Soifer
  • 2,715
  • 6
  • 27
  • 50
1
  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.
Gavy
  • 143
  • 2
  • 11
1

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.

jamesnotjim
  • 575
  • 7
  • 17
1

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

blueberry
  • 325
  • 2
  • 8
0

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.

Randy
  • 61
  • 9
0

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

Nagibaba
  • 4,218
  • 1
  • 35
  • 43