Something went wrong. Try again.
personal fork of atuin without AI stuff, sync stuff, script management stuff
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198#! /bin/shset -eu
ATUIN_NON_INTERACTIVE="no"
for arg in "$@"; do case "$arg" in --non-interactive) ATUIN_NON_INTERACTIVE="yes" ;; *) ;; esacdone
if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then if [ -t 0 ] || { true </dev/tty; } 2>/dev/null; then ATUIN_NON_INTERACTIVE="no" else ATUIN_NON_INTERACTIVE="yes" fifi
cat << EOF _______ _______ __ __ ___ __ _| _ || || | | || | | | | || |_| ||_ _|| | | || | | |_| || | | | | |_| || | | || | | | | || | | _ || _ | | | | || | | | | ||__| |__| |___| |_______||___| |_| |__|
Magical shell history
Atuin setuphttps://github.com/atuinsh/atuinhttps://forum.atuin.sh
Please file an issue or reach out on the forum if you encounter any problems!
===============================================================================
EOF
__atuin_install_binary(){ curl --proto '=https' --tlsv1.2 -LsSf https://github.com/atuinsh/atuin/releases/latest/download/atuin-installer.sh | sh}
if ! command -v curl > /dev/null; then echo "curl not installed. Please install curl." exitfi
__atuin_install_binary
# TODO: Check which shell is in use# Use of single quotes around $() is intentional here# shellcheck disable=SC2016if ! grep -q "atuin init zsh" "${ZDOTDIR:-$HOME}/.zshrc"; then printf '\neval "$(atuin init zsh)"\n' >> "${ZDOTDIR:-$HOME}/.zshrc"fi
# Use of single quotes around $() is intentional here# shellcheck disable=SC2016
if ! grep -q "atuin init bash" ~/.bashrc; then curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o ~/.bash-preexec.sh printf '\n[[ -f ~/.bash-preexec.sh ]] && source ~/.bash-preexec.sh\n' >> ~/.bashrc echo 'eval "$(atuin init bash)"' >> ~/.bashrcfi
if [ -f "$HOME/.config/fish/config.fish" ]; then if ! grep -q "atuin init fish" "$HOME/.config/fish/config.fish"; then printf '\nif status is-interactive\n atuin init fish | source\nend\n' >> "$HOME/.config/fish/config.fish" fifi
ATUIN_BIN="$HOME/.atuin/bin/atuin"
__atuin_install_agent_hook(){ agent="$1" agent_name="$2" agent_config_dir="$3" shift 3
detected="no"
if [ -d "$agent_config_dir" ]; then detected="yes" else for agent_command in "$@"; do if command -v "$agent_command" > /dev/null 2>&1; then detected="yes" break fi done fi
if [ "$detected" = "yes" ]; then echo "Detected $agent_name — installing Atuin hooks..." if ! "$ATUIN_BIN" hook install "$agent"; then echo "Failed to install Atuin hooks for $agent_name (this version of Atuin may not support it yet)." fi echo "" fi}
__atuin_install_agent_hook "claude-code" "Claude Code" "$HOME/.claude" claude__atuin_install_agent_hook "codex" "Codex" "$HOME/.codex" codex__atuin_install_agent_hook "pi" "pi" "$HOME/.config/pi" pi
echo ""echo "Atuin installed successfully!"echo ""
if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then
printf "Would you like to import your existing shell history into Atuin? [Y/n] " read -r import_answer </dev/tty || import_answer="n" import_answer="${import_answer:-y}"
case "$import_answer" in [yY]*) echo "" if ! "$ATUIN_BIN" import auto; then echo "" echo "History import failed. You can retry later with 'atuin import auto'." fi echo "" ;; *) echo "Skipping history import. You can always run 'atuin import auto' later." echo "" ;; esac
cat << EOFSync your history across all your machines with Atuin Cloud:
- End-to-end encrypted — only you can read your data - Access your history from any device - Never lose your history, even if you wipe a machine
EOF
printf "Sign up for a sync account? [Y/n] " read -r sync_answer </dev/tty || sync_answer="n" sync_answer="${sync_answer:-y}"
case "$sync_answer" in [yY]*) echo "" if ! "$ATUIN_BIN" register </dev/tty; then echo "" echo "Registration did not complete. You can run 'atuin register' any time to try again." fi ;; *) echo "" printf "Already have an account? Log in with 'atuin login'.\n" echo "You can also run 'atuin register' any time to create one." ;; esac
else echo "Non-interactive environment detected — skipping setup prompts." echo "You can run the following commands manually after installation:" echo "" echo " atuin import auto Import your existing shell history" echo " atuin register Sign up for a sync account" echo " atuin login Log in to an existing sync account"fi
if [ "$ATUIN_NON_INTERACTIVE" != "yes" ]; then "$ATUIN_BIN" setup </dev/ttyfi
cat << EOF
_______ __ __ _______ __ _ ___ _ __ __ _______ __ __| || | | || _ || | | || | | | | | | || || | | ||_ _|| |_| || |_| || |_| || |_| | | |_| || _ || | | | | | | || || || _| | || | | || |_| | | | | || || _ || |_ |_ _|| |_| || | | | | _ || _ || | | || _ | | | | || | |___| |__| |__||__| |__||_| |__||___| |_| |___| |_______||_______|
Thanks for installing Atuin! I really hope you like it.
If you have any issues, please open an issue on GitHub or visit our forum (https://forum.atuin.sh)!
If you love Atuin, please give us a star on GitHub! It really helps ⭐️ https://github.com/atuinsh/atuin
===============================================================================
⚠️ Please restart your shell or open a new terminal for Atuin to take effect!
===============================================================================EOF