-1

I looked at the microsoft docs but i am not good enough on terminal.

It says run this command:

sudo ln -s /path/to/vscode/Code /usr/local/bin/code

I customized it like this. But i don't understand what should be the second file path. First one is path to app as i understand.

sudo ln -s /opt/visual-studio-code/Code /usr/local/bin/code

I get this error when i run it:

ln: failed to create symbolic link ‘/usr/local/bin/code’: File exists
4
  • If you ran the first commands (sudo ln -s /path/to/vscode/Code /usr/local/bin/code) first, then it wouldn't work. Try running code in Terminal and seeing what it brings up. If nothing happens, then run sudo rm /usr/local/bin/code && sudo ln -s /opt/visual-studio-code/Code /usr/local/bin/code. This should re-create the symbolic link and you should be able to launch Visual Studio Code just fine. Sep 11, 2015 at 23:16
  • it says "not found" if i run code
    – atilkan
    Sep 11, 2015 at 23:17
  • other code parts i tried and it said: [3733:0912/021859:ERROR:browser_main_loop.cc(173)] Running without the SUID sandbox! See code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
    – atilkan
    Sep 11, 2015 at 23:19
  • refer here
    – Ravan
    Sep 11, 2015 at 23:26

1 Answer 1

2

emrah "file exists" means the symbolic link had been created before by you provided you had double clicked on the code file found in the extracted vscode zip file. Use these steps(1):

  • create a folder say in your documents folder
  • open a terminal and navigate to that folder
  • in your terminal run 'sudo code .' (Note: without the quotes)

if the folder opens in visual studio code then that link you created perhaps unknowingly is working so your good to go, but if the folder doesn't open then that link is badly created. Use these steps to correct the issue:

  • run this from your terminal sudo rm -R /usr/local/bin/code
  • then rerun sudo ln -s /path/to/vscode/Code /usr/local/bin/code
  • now navigate to the folder you created previously from a terminal and try and run this from that folder 'sudo code .' (Note: without the quotes), it should launch vscode with that folder.

Please do and let me know if it helped.

7
  • I tried on mac. But did not work. I had this problem on ubuntu. But same on mac too.
    – atilkan
    Oct 16, 2015 at 17:21
  • I made it work on mac. will try on ubuntu when i get home.
    – atilkan
    Oct 16, 2015 at 20:04
  • Hi emrah if it worked for you could you mark it as the answer? Oct 18, 2015 at 15:11
  • Sorry, I didn't solve with your answer. And it has to work on ubuntu. I will try.
    – atilkan
    Oct 18, 2015 at 21:27
  • 1
    You don't run graphical applications with sudo. Otherwise you'll end up with root owned files
    – Anwar
    Nov 8, 2016 at 6:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .