mirror of
https://github.com/pyenv/pyenv.git
synced 2026-09-10 15:46:17 -04:00
Page:
MacOS login shell
3
MacOS login shell
native-api edited this page 2022-09-19 20:01:56 +03:00
Configure the terminal to run your shell as a login shell
The stock shell configuration examples for Pyenv 2.0.0-2.2.5 for MacOS assume that the shell in the terminal runs as a login shell.
Check if the current shell is a login shell
-
Bash:
shopt -q login_shell && echo 'Login shell' || echo 'Not login shell' -
Zsh:
if [[ -o login ]]; then echo "login shell"; else echo "not login shell"; fi -
Fish:
status --is-login; and echo "login shell"; or echo "not login shell"
Set the shell to run as a login shell
There are two possible ways here.
Set the shell as your login shell (recommended)
-
System Preferences>Users and groups> Open the padlock to allow changes > Right click on the corresponding user's name >Advanced options> Select the shell from the dropdown list next toLogin shell- Alternatively, in the terminal:
chsh -s <shell>
- Alternatively, in the terminal:
-
Then, in the Terminal app:
Preferences>General>Open shells with>Predefined login shell
Configure the terminal to explicitly run a shell as a login shell
-
In the Terminal app:
Preferences>General>Open shells with>Command (full path)- Zsh:
/bin/zsh --login - Bash:
/bin/bash -l - Fish:
<path to fish executable> --login
- Zsh:
(See the "Pages" link above for a full list of wiki pages.)
#!/usr/bin/env bash
#
# Summary: One line, short description of a command
#
# Usage: pyenv COMMAND [--optional-flag] <required-argument>
#
# More thorough help text wrapped at 70 characters that spans
# multiple lines until the end of the comment block.
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Optional: Abort with usage line when called with invalid arguments
# (replace COMMAND with the name of this command)
if [ -z "$1" ]; then
pyenv-help --usage COMMAND >&2
exit 1
fi