Configuring the terminal to run Elvish
This is the recommended way to use Elvish as your default shell.
macOS terminals
Terminal | Instructions |
---|---|
Terminal.app |
|
iTerm2 |
|
Linux and BSD terminals
Terminal | Instructions |
---|---|
GNOME Terminal |
|
Konsole |
|
XFCE Terminal |
|
The following terminals only support a command-line flag to change the shell. Depending on your DE, you can either create a wrapper script or modify the desktop file:
Terminal | Instructions |
---|---|
LXTerminal | Pass --command $path_to_elvish . |
rxvt | Pass -e $path_to_elvish . |
xterm | Pass -e $path_to_elvish . |
tmux
Add the following to ~/.tmux.conf
:
if-shell 'which elvish' 'set -g default-command elvish'
This only launches Elvish if it’s available, so it’s safe to have in a
.tmux.conf
that you sync with machines where you haven’t installed Elvish yet.
Windows terminals
Terminal | Instructions |
---|---|
Windows Terminal |
|
ConEmu |
|
VS Code
Open the command palette and run “Open User Settings (JSON)”. Add the following:
"terminal.integrated.defaultProfile.linux": "elvish",
"terminal.integrated.profiles.linux": {
"elvish": {
"path": "elvish"
},
}
Change linux
to osx
or windows
depending on your operating system. See
VS Code’s documentation
for more details.
Changing your login shell
On Unix systems, you can also use Elvish as your login shell. Run the following Elvish snippet:
use runtime
if (not (has-value [(cat /etc/shells)] $runtime:elvish-path)) {
echo $runtime:elvish-path | sudo tee -a /etc/shells
}
chsh -s $runtime:elvish-path
You can change your login shell back to the system default with chsh -s ''
.
Dealing with incompatible programs
Some programs invoke the user’s login shell assuming that it is a traditional POSIX-like shell, so they may not work correctly if your login shell is Elvish. The following programs have been reported to have issues:
Such programs usually rely on the $SHELL
environment variable to query the
login shell. For CLI applications, you can create an alias in your rc.elv
that
forces it to a POSIX shell, like the following:
fn gdb {|@a|
env SHELL=/bin/sh gdb $@a
}
There is no universal way to override environment variables for GUI applications; it depends on the GUI environment and possibly the application itself. It may be easier to switch the login shell back to the system default and configure your terminal to launch Elvish.