Building Atom for 64-bit Arch Linux

As most people have heard, Github open-sourced their new text editor Atom a few days ago. What you may not know, or care if you have OS X, is that since Atom is now open-source you can build it for other platforms. Github has some base instructions posted here, but they don't outline the entire process or walk you through the build.

Github's instructions for building on Linux

  • Ubuntu LTS 12.04 64-bit is the recommended platform
  • OS with 64-bit architecture
  • node.js v0.10.x
  • npm v1.4.x
  • sudo apt-get install libgnome-keyring-dev

  • npm config set python /usr/bin/python2 -g to ensure that gyp uses Python 2

git clone https://github.com/atom/atom  
cd atom  
script/build              # Creates application at /tmp/atom-build/Atom  
sudo script/grunt install # Installs command to /usr/local/bin/atom  

Going from the above instructions, I will be building Atom for 64-bit Arch linux with the following setings:

Archey

The first step is to install nodejs, which is conviently in the Arch package repository

installing nodejs

The second step is to verify that you have libgnome-keyring (you don't actually need the dev tools) installed. If it's not installed, install it now.

You can query a local package using pacman -Q <package_name>, but I typically just use pacman -Ss <package_name> to search through the Sync repository; if I have the package installed already it will say so beside its entry.

searching for libgnome-keyring

The next step says to configure npm to use python2 because that is what node-gyp requires, Arch uses Python3 by default.

sudo npm config set python /usr/bin/python2 -g  

which should complete without error.

Now we actually clone the project and try to build:

git clone

Following the next set of steps:

script/build

generates a bunch of warnings, eh ignore them. But when it comes time to install the modules it throws an error as well:

script/build error

gyp ERR! stack Error: Python executable "python" is v3.4.0, which is not supported by gyp

What happened? I thought we just configured npm to use python2...Well apparently that doesn't work.

Workaround:
1. create symlinks to /usr/bin/python2 and /usr/bin/python2-config in your home directory (in some folder; I used ~/bin)
2. prepend ~/bin to your $PATH environment variable, so that when gyp goes looking for python interpreters it finds those first.

export PATH=~/bin:$PATH  

Anyone familier with *nix is probably choking on their coffee at how much of a security risk this could be. Don't worry, you can remove the symlinks after Atom builds.

Now try running script/build again:

script/build with no errors

and you should get a nice screen full of green checkmarks!

The final step is to run the grunt task to install the binaries for atom and apm into /usr/local/lib.

script/grunt install

which should also complete without any errors. You can now remove the python symlinks we created and remove ~/bin from your $PATH.

Now we can run atom, try running it from your terminal:

/usr/bin/local/atom
# or just atom if /usr/local/bin is in your PATH

And you get a nice little error message:

run atom without so

Alright, well we need an older version of libgcrypt, one that install libgcrypt.so.11. There is conviently a package in the AUR with exactly what we want: libgcrypt15. Without this package we would have had to either find an old mirror or compile that version ourselves (gross).

We can install package from AUR using pacman (this package does a lot of compilation and tests, so it may take a minute to build with makepkg):

libgcrypt15 start libgcrypt15 end

Now you can verify that libgcrypt.so.11 is indeed in /lib:

ls /lib/libgcrypt*  

Now we can try running atom again:

/usr/bin/local/atom
# or just atom if /usr/local/bin is in your PATH

And we get another error about a missing shared library:

libudev missing

This time the solution is much simpler, we are just going to symlink our current librudev library to the name that atom is looking for:

libudev symlink

NOW we can finally run atom:

atom running

Finishing touches:
1. Create a Desktop lanuncher for Atom
2. Download a new icon because the resolution on the default icon is awful.

Here are two that are really clean:
- https://github.com/zeke/atom-icon - http://leftly.me/atom-app-custom-icon/

NOTE: Prepare for this to break when Github makes updates

I am also going to try and set up an AUR package for atom and keep it up-to-date. If anyone has thoughts on Atom, feel free to comment below. I am still not using it day to day because it is not as full-featured as sublime-text; if it reachs that point I could probably be convinced to make the switch.

Happy editing.

UPDATE: There is already a package on AUR, so apparently I didn't need to go to any of this trouble. AUR package