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

dotnet command can't be found on osx with RC2 bits #6109

Closed
julielerman opened this issue May 16, 2016 · 38 comments
Closed

dotnet command can't be found on osx with RC2 bits #6109

julielerman opened this issue May 16, 2016 · 38 comments

Comments

@julielerman
Copy link

I was updating to the latest (2072) bits. The install seemed ok but some other issue caused me to uninstall and reinstall and now dotnet is totally lost.

Initial success:
I ran the dotnet uninstall script on OSX and then installed from the 2072 package.
Ran dotnet --version which reported the correct version.
Ran dotnet new then dotnet run to verify that things were working.

Problems with dotnet restore
I think tried to updated an existing project follwing guidance that suggested adding:
"dependencies":
{

"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-*"
}

dotnet restore responded with "unknown keyword platform". Various threads on the web pointed to people noto having the latest version of teh CLI installed which I did.

I recalled seeing Richard Landers issue about the uninstaller script not fully uninstalling earlier versions of dotnet. I found the related PR (dotnet/cli#3042). I think started the uinstall/reinstall process again using the version of the uninstaller from the PR.

After reinstalling the 2702 package that I had had success with earlier (dotnet-dev-osx-x64.1.0.0-preview1-002702), I was no longer able to run any dotnet commands.

Any time I ran anythingn with dotnet, I get "command not found".

Also, there is no dotnet folder in .local/shared on my computer.

The installer reports a successful install. I can see it running through and saying "copying files" etc. But I can't find any dotnet folders anywhere on this computer (searching hidden as well).

cc @blackdwarf

@dasMulli
Copy link
Contributor

Is there a /usr/local/share/dotnet/ folder?

Try sudo rm -rf /usr/local/share/dotnet and sudo rm /etc/paths.d/dotnet to clear the install location and PATH entries, then run the installer again. That helped me a couple of times.

@julielerman
Copy link
Author

thanks. no there is just no dotnet folder at all. Will report back on trying to get rid of the installer files and re-install.

@dasMulli
Copy link
Contributor

You can try hitting Command-L on the pkg installer and see if there is an error / suspicious message logged. os x pkgs sometimes report false positive installs when a script fails..

@julielerman
Copy link
Author

cmd -l just creates aliases. Right click/info does not show any logs. I can't find an etc folder anywhere. Is this stuff just not there or is this my stupendous lack of experience with osx that's getting in the way?

@blackdwarf
Copy link

@julielerman you have to have /etc/ in you FS, otherwise your OS would not work. 😄

Are you working from a terminal?

@julielerman
Copy link
Author

julielerman commented May 16, 2016

Oh I see it ...going back & forth from terminal to finder (which has been set up to show hidden files). Now I'm seeing it in terminal.

@blackdwarf
Copy link

@julielerman no, it doesn't touch that part. OK, if you go down into the terminal and type the following:

cd /
cd /etc
ls

What happens?

@julielerman
Copy link
Author

i see dotnet folder now and drilling in I see evidence of it being 2702. Now I will go back to see about dotnet commands.

@julielerman
Copy link
Author

still not found (dotnet command) . These are the symlinks I set up:
ln -s /usr/local/share/dotnet/bin/dotnet /usr/local/bin/
ln -s /usr/local/share/dotnet/bin/csc /usr/local/bin/

@julielerman
Copy link
Author

is this related? Should there be someting in bashprofile? https://github.com/dotnet/cli/issues/2005

@julielerman julielerman changed the title dotnet (2702) nowhere to be found on OSX dotnet command can't be found on osx with RC2 bits May 16, 2016
@dasMulli
Copy link
Contributor

uhm.. why symlinks? first, they shouldn't be necessary (pkg will append to /etc/paths.d/dotnet, os x will set up your env to include those in your $PATH), 2nd dotnet/bin/* is gone. try removing all of these.
If using the terminal is too confusing, you can use command-shift-G on any finder window. That will open a prompt where you can type a directory name that finder will open. If you just enter /usr/local/share there you should be able to find your dotnet folder.. OS X tries to "protect" you from all those directories by default

@julielerman
Copy link
Author

symlinks was suggested in the original issue where I reported my problem. I'm not confused by terminal. I was confused by usr vs user the latter meaning "insert your name here". I've been on windows for a few decades but Mac only for a few months so I have some big knowledge gaps. I finally got high enough in the file path to see the real usr folder.

dotnet is installed. I can see it. But dotnet commands are not working. Any time I try to run dotnet I get Command not found. That maybe be a PATH issue but that is all supposedly taken care of with the installer.

thanks so much for continuing to try to help me even though it may seem that I"m so clueless that it may be futile.

@dasMulli
Copy link
Contributor

np, i figured. That os x "i'll just show you some directories where you can't break things and hide my *nix heritage" is confusing anyway ^^.

So, check that when you open a Terminal and execute /usr/local/share/dotnet/dotnet --info something useful ist displayed. That means that dotnet itself is working.

Then check that there is a file /etc/paths.d/dotnet that lists the directory /usr/local/share/dotnet.
you can check this by executing cat /etc/paths.d/dotnet (that just prints the file's content).

If both are satisfied, log out / in again to make sure your environment is clean (restart will do as well). Then dotnet --info on it's own should show something corect.
If not.. possibly do a which dotnet to see if that shows anything.

@dasMulli
Copy link
Contributor

dasMulli commented May 16, 2016

another thing that comes to my mind:
you might have a broken symlink. /usr/local/bin/dotnet (your symlink) might point to a non-existing file and causing the command not found error. Just delete all those symlinks..

@blackdwarf
Copy link

@dasMulli we need the symlinkfor now for zsh users because path_helper is not working in all instances so this happens.

@julielerman
Copy link
Author

Hey! I deleted the symlink and recreated it and dotnet works again!!!!!!!!!!!!!!!!!!!! :)

It was broken before I added the symlink originally. But whatever I've done to fix dotnet was not being recognized and the symlinnk was tied to it.

FWIW among the 5 million things I tried, I did switch back to bash (exec bash) but dotnet still (at that time) was coming up as command not found.

So I will close this but I just want to reiterate where the problem began.

I had an old RC2.
I used the normal uninstall script and installed the new CLI package.
dotnet was working.
Someting else was not working so I wanted to be sure I had cleared out the old stuff properly.
I used the PR version of the uninstaller. Reinstalled from the package and that's when dotnet command was gone.
That was before trying any symlink.

THANKS FOR ALL OF YOUR HELP AND PATIENCE!!!
(p.s. I learned a lot more about my mac today too :) )

@anorborg
Copy link

I'm still having this issue. I followed the steps laid out by @dasMulli, but still get -bash: dotnet: command not found. I have previously had the issue when using the nightly builds, but thought it would be fixed for the official RC2. I also followed the instructions here: https://www.microsoft.com/net/core#macosx including the uninstall. Any help?

@julielerman
Copy link
Author

Hey, if I can get it working anyone should be able to. Have you tried deleting all of the caches in
[username]/.local/share/Nuget/v3-cache
&
[username]/.nuget/packages

I really went around in circles for a long time until it finally kicked in. So my path to success is not very clear.

@blackdwarf
Copy link

@anorborg this is a closed issue, can we move the discussion over to #5193 ?

@anorborg
Copy link

@blackdwarf , not using zsh that I know of, just the base OSX El Capitan Terminal. Is that still the right bug or a new one? Thanks @julielerman I'll give it a shot

@blackdwarf
Copy link

blackdwarf commented May 18, 2016

@anorborg oh, ok then, nope it is not. Can you open a new issue and /cc me. :)

@anorborg
Copy link

no luck @julielerman. @blackdwarf, let me know if I should post a new issue or if someone can reopen this one.

@julielerman
Copy link
Author

julielerman commented May 18, 2016

@anorborg i'm interested in sorting this out. If you want to do a skype to see if I can help you hit all the things I did to see if there is a silver bullet, email me at my alias at gmail then we can share what we've learned.

@blackdwarf
Copy link

OK, let's reopen this one then. @anorborg can you tell me:

  1. Which shell you are using (bash, zsh)
  2. Did the install finish correctly, that is, is there directory in /usr/local/share/ called "dotnet" and if there are things in it.

@blackdwarf blackdwarf reopened this May 18, 2016
@anorborg
Copy link

@blackdwarf

  1. Shell bash (echo $SHELL returns /bin/bash
  2. ls /usr/local/share/dotnet/ returns
dotnet          sdk
libhostfxr.dylib    shared

@blackdwarf
Copy link

@anorborg ok, can you do ls /etc/paths.d/ and show the output of that. Also, you did start a new Terminal instance/tab after installing the PKG?

@anorborg
Copy link

anorborg commented May 19, 2016

yeah, did a full restart per an eariler comment in the thread:

ls /etc/paths.d/ output:

dotnet

@anorborg
Copy link

I think I figured it out. I think the issue is actually the Github Mac Client. my .bash_profile has the following line in it:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/GitHub.app/Contents/Resources/git/bin:/Applications/GitHub.app/Contents/Resources/git/libexec/git-core

which appears to overwrite the PATH variable instead of appending. I commented out the line and dotnet worked. So this may be an issue with Github Desktop Client. If someone can confirm this behavior is incorrect I can attempt to report this to Github.

@blackdwarf
Copy link

blackdwarf commented May 19, 2016

@anorborg ah, that thing. You can actually keep that and just have the following:

export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/GitHub.app/Contents/Resources/git/bin:/Applications/GitHub.app/Contents/Resources/git/libexec/git-core

I don't know who did that to your .bash_profile but that is the reason why it is happening. And yes, they should not be doing this. They should be adding your path as well.

@julielerman
Copy link
Author

woah! I'm going to go look to see if that's in mine. Really hoping to find a common thread to this problem!

@anorborg
Copy link

anorborg commented May 19, 2016

Changing the line definitely worked for me @blackdwarf. Not sure if I messed that up at some point or maybe a Github Mac Client issue that isn't wide spread? (Don't see anything similar when googling, but maybe not many people use the github GUI client.) At any rate, I'm up and running. Thanks @blackdwarf and @julielerman for your help!

@julielerman
Copy link
Author

nah ...that wasn't it for me. Checking zsh not bash_profile I have some dnx stuff but don't see anything around bin. I still don't know if using the updated uninstall was what did it. It seemed to be...since I had dotnet after running the default uninstall and the install package. It disappeared after the PR version of the uninstall which has since changed. Who knows. At least there's one more piece of info on this for bash! Glad you found it.


export PATH="/Users/julialerman/.dnx/runtimes/dnx-mono.1.0.0-rc1-update1/bin:/Users/julialerman/.dnx/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet/bin"

[ -s "/Users/julialerman/.dnx/dnvm/dnvm.sh" ] && . "/Users/julialerman/.dnx/dnvm/dnvm.sh" # Load dnvm

@blackdwarf
Copy link

Well, @julielerman that line above will also overwrite your path. So, it seems the real solution here is to go back to symlinking. :(

@anorborg
Copy link

I think an additional helpful diagnostic step is to echo $PATH. If the PATH is being overwritten by a shell configuration, you should see that its missing the reference to dotnet.

Regarding GitHub Mac Client. I did a fresh install on a clean mac and no issue, so this could be a bad .bash_profile mod on my end at some point.

@blackdwarf
Copy link

Will track this with dotnet/cli#3063 so closing this one.

@julielerman
Copy link
Author

just a note that I pointed out these zsh and bash anomalies along with links to this issue and 3063 in my blog post about updating to RC2 (http://thedatafarm.com/data-access/updating-to-rc2-changes-to-efcore-aspnetcore-postgresql-driver-xunit/)

@theclai
Copy link

theclai commented Jun 13, 2016

i just close my current terminal then open new terminal again then its work

@morenoh149
Copy link

zsh user here, still an issue, I have /etc/path.d/dotnet file with correct contents and the binary is installed at /usr/local/share/dotnet/dotnet. I'll just add this path to my path environment variable.

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
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

6 participants