This article describes how to compile zshell on a Linux machine without root, for instance when working remotely on a server on which you do not have root.
#Step 1: Dependencies
#ncurses
To compile zsh
, you need ncurses
. This needs to be compiled with the flag -fPIC
. This can be achieved as follows:
Now before installing the compiled files, you should check to make sure that ncurses has compiled correctly by running:
If this successfully opens a prompt with multiple options, then ncurses has been successfully compiled, and you can install it:
Note that the --enable-shared
configure flag ensures that libtool builds shared libraries for ncurses, needed for zsh
later on.
icmake
Now, this may be all you need, but if you don’t have it installed, you also need the documentation builder yodl
, which in turn needs icmake
. If these are installed already, you can skip straight ahead to Part 2.
Firstly, icmake
is installed via:
Now the INSTALL.im
file needs to be altered to reflect our local installation. This means replacing all the file installation locations with local directories as such, where
Now run the following to compile icmake:
Now, technically, this will compile all the files you actually need in tmp
, but if you further want to install the files to ~/.local, then you simply run:
If you then want to clear up the temporary compiled files, delete the directory tmp
with rm -rf tmp
.
yodl
Now to move onto yodl. Again, we need to specify that we want to install locally by putting BASE = "/home/as1423/.local" at the start of the function
setLocations()located at the end of
INSTALL.im’, so that the function looks like:
In addition, we need to tell build
to look in our local directory for icmake
instead of the standard /usr/bin
or /usr/local/bin
. This means editing the hashbang at the top of build
to look as follows, where again
Now that build
knows that we want to run our locally compiled icmake
, we can actually build yodl
:
There may be a LaTeX error when running ./build manual
, but just ignore this, because it’s not vital.
Now we’re ready to actually install yodl:
Note that the /
designates that we are installing with respect to the root of our filesystem. This is fine, though, because we’ve already specified in INSTALL.im
that we want everything to be installed locally into $HOME/.local$. Now
yodl` should be successfully installed.
Step 2: Tell environment where ncurses is
Before compiling zsh
, you need to tell your environment where your newly compiled files are (if you haven’t already). This can be achieved with:
Step 3: Compiling zsh
Now, we’re finally ready to move onto compiling zsh
:
Step 4: Enjoy zsh
!
After these steps have been completed, zsh should be ready and compiled to use in your ~/.local/bin folder. If you like zsh
, you’ll love ohmyzsh
. This can be installed by:
Or if you don’t want o execute shell scripts from arbitrary non-https website, you can use git:
Once you’ve done this, edit oh-my-zsh to your needs, e.g. if you want to change the theme, replace ZSH_THEME="robbyrussell" with the theme of your choice. I particularly enjoy
jonathan`.
And finally, change your shell to zsh
:
Now sit back and enjoy your effortless tab completion, directory movement and integrated git information.
#Troubleshooting
If, when installing zsh
, either make
or make install
fail despite all other programs being compiled and present, you may need to run make realclean
to remove ALL compiled files, and start the compilation from autoheader
. This sometimes happens if you run ./configure
before installing yodl
, meaning the config.h
and Makefile
files have been built without knowledge of yodl
and need to be purged.
If zsh
isn’t recognising the ncurses
library when running ./configure
, and instead giving the following error:
Then this means that you haven’t got the ncurses
library in your library path. You can add it to your environment by re-running the commands in Part 2, in particular the final command exporting CPPFLAGS
and LDFLAGS
.
References
This autotools flow chart from Wikipedia
The somewhat cryptic and involved zsh INSTALL file.