alacritty: MacOS new terminal doesn't have shell environment

If I open a new instance with:

open -na 'Alacritty.app'

it works as expected. However if I supply an initial command with the --command flag:

open -na 'Alacritty.app' --args --command nnn

it launches but doesn’t have the shell environment loaded. i.e. My .zshrc has not been run/loaded.

Expected behaviour

Just like when launching alacritty with no initial command, I expect alacritty to load the shell environment before executing the --command

System

OS: macOS Version: 0.4.2

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@chrisduerr omg yes that one works!!! Thank you so much for you help and patience!

For anyone else who comes across this, this is the command I have in my .skhdrc file which works:

shift + ctrl + alt - space : open -na Alacritty.app --args -e zsh -ic nnn

I don’t usually use macOS, which makes it a bit difficult to give you an exact working example, but it boils down to shell -c not starting an interactive shell by default, since you’ve told it to just run a command with no interactivity needed. Without an interactive shell the .bashrc is not sourced.

Depending on your shell, there might be different flags to tell it to still spawn an interactive shell, one such way would be to spawn a login shell, however login shells on macOs are a bit complicated since login works differently. On a normal system just using alacritty -e shell --login -c env would work.

Another alternative, what I’d probably recommend testing is to just tell it to start in interactive mode. With your specific issue that would probably suffice. With zsh you can try running alacritty -e zsh -ic env to do so.