Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every time a new terminal session starts asdf adds new lines to the .zshrc file #892

Closed
overtune opened this issue Mar 15, 2021 · 4 comments

Comments

@overtune
Copy link

Describe the bug

Everytime I start a new session in a terminal (like opening a new tab in iTerm) my .zshrc file is updated with new lines containing:

. /usr/local/opt/asdf/asdf.sh

. /usr/local/opt/asdf/asdf.sh

To Reproduce

I have updated asdf to the latest version on Homebrew and use it with Oh My Zsh.

Expected behavior

It shouldn't append new lines to .zshrc evertime a new session is started.

Environment

OS:
Darwin MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64

SHELL:
zsh 5.8 (x86_64-apple-darwin20.0)

ASDF VERSION:
v0.8.0

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/opt/asdf

ASDF INSTALLED PLUGINS:
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git
@seivan
Copy link

seivan commented Mar 15, 2021

Somewhere along the line you are sourcing code that does something like

echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.zshrc

See if you can find that anywhere.

@jthegedus
Copy link
Contributor

There is a language differnce in the "Add to your shell" section for Homebrew vs Git in the docs.

With Homebrew we say

Add asdf.sh to your ~/.bash_profile with:
echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.zshrc

This is a command you should execute in your terminal, so brew prefix is computed once on setup.

With Git we specify

Add asdf.sh to your ~/.bash_profile with:
. $HOME/.asdf/asdf.sh

These are the contents you should add manually to your Shell config.

As @seivan says, you probably have the whole echo command in your Shell config so it is appending every time.

We had updated the Homebrew section to be consistent with the Git method, but computing brew prefix is expensive and slowed peoples Shells.

@overtune
Copy link
Author

Thanks!
You're right, I did had the whole echo row in a file that was sourced in my .zshrc. That's why I didn't found anything when I search for asdf in my .zshrc.
Feeling dumb :)
But thanks for pointing out this!

@jthegedus
Copy link
Contributor

It's not your fault, the docs are different depending on system. Ideally the flow should be the same. Hopefully some other changes will make this easier in the future. Thanks for giving asdf a go :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants