1

How to install Scratch 2 on Ubuntu 16.10. or 17.04 (64bit)?

Have followed the code by Martin but permission is denied and no such file exists messages appear.

The first bit of code seems to have worked so I have the scratch.air file

Any help appreciated - code I've tried is below :

Create launcher:

$ cat << _EOF_ > /usr/share/applications/Scratch2.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/opt/adobe-air-sdk/adobe-air/adobe-air /opt/adobe-air-sdk/scratch/Scratch-456.0.1.air
Icon=/opt/adobe-air-sdk/scratch/scratch.png
Terminal=false
Name=Scratch 2
Comment=Programming system and content development tool
Categories=Application;Education;Development;ComputerScience;
MimeType=application/x-scratch-project
_EOF_

$ chmod +x /usr/share/applications/Scratch2.desktop
Charles Green
  • 21,339
Cookie UK
  • 11
  • 3

2 Answers2

2

Normally, the /usr/share/applications directory is owned by root - you won't be able to cat to a file there without sudo. You can either modify the here-doc command to

cat << _EOF_ | sudo tee /usr/share/applications/Scratch2.desktop

or just use an editor to create the .desktop file instead

sudoedit /usr/share/applications/Scratch2.desktop

FWIW I don't believe .desktop files need execute permission, but if they did you would need sudo to change that as well

sudo chmod +x /usr/share/applications/Scratch2.desktop
steeldriver
  • 136,215
  • 21
  • 243
  • 336
  • Thanks for that steeldriver. A bit confused now though.What do I need to type insteadof the grey box in my question then? – Cookie UK Sep 16 '17 at 13:28
  • You can either type sudoedit /usr/share/applications/Scratch2.desktop and then type everything from [Desktop Entry] to MimeType=application/x-scratch-project into the editor or simply replace the > in the first line of your existing command by | sudo tee. Alternatively, drop to a root shell at the start using sudo -i and then type everything as-is. I would omit the chmod command altogether, for the reason I mentioned above. – steeldriver Sep 16 '17 at 13:44
  • Ah! Asks for password then opens GNU nano 2.5.3. with ta terminal-looking window. If I try pasting the code again nothing happens after the MimeType line. – Cookie UK Sep 16 '17 at 17:53
  • You use the Ctrl+Key combinations indicated at the bottom of the screen to save and exit - see How to edit files in a terminal with nano? – steeldriver Sep 16 '17 at 18:02
  • I'm sorry I have no idea why I have a new windownow and what has happened. – Cookie UK Sep 16 '17 at 18:37
  • I just want a desktop icon showing Scratch – Cookie UK Sep 16 '17 at 18:38
1

Thank you so much for this answer. It worked perfectly. I'm posting this as an answer since it is clear-er for me/others to see how easy it is.

As stated in the comments, I replaced the line provided in the previous answer for the original command given then I just copied the rest of the command. Thanks again... It worked beautifully. I also changed the Scratch version to download. I first installed the version(number 456.0.1) but the updated just downloads and does not installs it.... I checked the current version -456.0.4- on the website and I changed it accordingly to all the commands to install it.

cat << _EOF_ | sudo tee /usr/share/applications/Scratch2.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/opt/adobe-air-sdk/adobe-air/adobe-air /opt/adobe-air-sdk/scratch/Scratch-456.0.4.air
Icon=/opt/adobe-air-sdk/scratch/scratch.png
Terminal=false
Name=Scratch 2
Comment=Programming system and content development tool
Categories=Application;Education;Development;ComputerScience;
MimeType=application/x-scratch-project
_EOF_