Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 205
1Engels Avatar asked Sep 05 '12 14:09

1Engels


People also ask

How do I install package control?

Steps for Installing Package Control (Sublime Text 3):Open the Command Palette: Press Ctrl+Shift+P (Windows) or Cmd+Shift+P (OS X). Type 'install' in the Command Palette input box, which should autocomplete to 'Install Package Control. ' Press Enter to select it. Sublime Text 3 will start installing Package Control.

What is package control in sublime?

As you probably noticed on the homepage, Package Control is the Sublime Text package manager. It includes a list of over 2,500 packages available for install, and users can add any GitHub or BitBucket repository themselves. Once installed, packages are kept up-to-date automatically.

How do I download packages in Sublime Text?

Download and install Package Control Go to SublimeText – Preferences – Package Control (MAC) or Preferences – Package Control (PC) Choose “Install Package” from the list of options. Find the name of the package you wish to install and select it.

How do I open Control Panel in sublime?

Using Command Palette To open a command palette in Sublime Text editor, you can use the shortcut key combination Ctrl+Shift+P on Windows and Cmd+Shift+P on OSX.


3 Answers

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.

like image 77
SoldierCorp Avatar answered Sep 30 '22 06:09

SoldierCorp


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.

like image 44
Goddard Avatar answered Sep 30 '22 05:09

Goddard


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

like image 32
Paul Nelson Baker Avatar answered Sep 30 '22 04:09

Paul Nelson Baker