1Engels
1Engels

Reputation: 181

Can't install package control in Sublime text 2

I'm using ubuntu 12.04. I did what it says on the website but I got this error:

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); 
open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
Traceback (most recent call last):

File "<string>", line 1, in <module>
IOError: [Errno 13] Permiso denegado: u'/home/housepc/.config/sublime-text-2/Installed Packages/Package Control.sublime-package'

permiso denegado : "permission denied" 

What could I do to install it?

Upvotes: 17

Views: 20926

Answers (6)

SoldierCorp
SoldierCorp

Reputation: 7700

Just open terminal and execute this line:

sudo chmod -R 777 "/home/{youruser}/.config/sublime-text-2/Installed Packages/"

and try to install the package control again.

Upvotes: 24

Eleanor Zimmermann
Eleanor Zimmermann

Reputation: 432

Also, check that you're not on a proxy network. I was only able to install Package Control after switching to a non-proxy network.

Upvotes: 1

eloone
eloone

Reputation: 4354

After installing sublime text try : sudo /usr/bin/subl

This worked for sublime text 3 on Ubuntu 12.04

Upvotes: 0

Niko
Niko

Reputation: 4448

I don't believe that chmod -R 777-ing is the best solution to this problem. Granted, it will let you install the package but I don't think that anyone should get into the habit of just opening the permissions floodgates anytime write-access is denied. In this case, it's really not a big deal. I don't think that your sublime-text packages folder is a high priority, but none-the-less getting into the habbit of allowing everyone write access could cause problems later down the line, especially if the end user is a new *nix user and doesn't know why they are changing permissions.

(Just as a note: I'm running sublime-text-3, but that shouldn't matter because this is a permission issue and not an issue with sublime-text itself)

In my case, I had two problems.

  1. Sublime-Text was installed to the correct directory, but was owned by root.

    The first and obvious solution was to sudo chown -R username:username /home/username/.config/sublime-text-3. This returned control of the directory to me.

  2. The permissions on my installation somehow were set to something wonky. (At some point something I must have done set them incorrectly. What that would have been or when slips my mind, but I have been known to do dumb things while sleep deprived during finals week)

    To fix this is also simple. chmod -R 755 /home/username/.config/sublime-text-3/. The allows for you to write to the directory, but not other people who shouldn't already be all ready be allowed to write there. Unless you intentionally want to give everyone write access to a directory the most you should give is 775 which allows other users in the same group to write to that directory.

Like I said before, this isn't necessarily going to be a problem if any user on your system can write to your sublime-text packages folder. I don't see any real issues with it in itself, but getting into the habit of making something fully write-able could result in a mistake that opens your system up to vulnerabilities if you don't know the consequences of your actions.

Further reference: http://www.linux.com/learn/tutorials/309527-understanding-linux-file-permissions

Upvotes: 8

Timothy
Timothy

Reputation: 4285

The easiest thing would be to make the sublime-text folder writeable:

sudo chmod -R 777 "/home/{youruser}/.config/sublime-text-2/

or for sublime text 3:

sudo chmod -R 777 "/home/{youruser}/.config/sublime-text-3/

Then try to install package control again.

Upvotes: 1

Goddard
Goddard

Reputation: 3059

The easiest method is simply to run sublime text with sudo privalges.

I just pop open a terminal with ctrl+alt+t

make sure you are the owner of the directory instead of root with

sudo chown -R {youruser}:{youruser}  "/home/{youruser}/.config/sublime-text-2"

sudo sublime

After that open the sublime text console with ctrl+` and enter

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

After the initial install you can run sublime text normally.

Upvotes: 19

Related Questions