installing .net core on mac - bash

I am installing .net core on a mac and hoping to play around with it a bit on vs code. I am following the steps from
https://www.microsoft.com/net/core#macosx.
However, when I run
dotnet new
I get command not found on bash.
I have followed these previous steps
brew update
brew install openssl
brew link --force openssl
I have also downloaded the core package (installed successfully). I do not see any other steps. Wondering if I am missing a step or how to identify what is missing?

Sometimes I am not sure why the installer doesn't add the PATH to your environment.
Run below in terminal and reopen the terminal:
echo 'export PATH="$PATH:/usr/local/share/dotnet"' >> ~/.bashrc
(Note: If you are using zsh or other shells, please change the above ~/.bashrc to the initialize script of your shell, e.g. ~/.zshrc)

I ran into this same problem earlier today. The fix for me was to close out all Terminal windows, open a new one, then re-run the command.

Related

Local development on Mac M1 | Laravel & VueJs

I've just switched to MacOs - never used it before and I'm using Macbook M1 Pro, so a newbie here. Also, I've only started with web dev so I'm fairly new in this field as well.
Now, how should I proceed in order to set-up a local development enviroment - I plan to use mainly Laravel & VueJs?
Things I've done so far:
Installed VS code
Installe MAMP
Cloned my Git repository with project I was working on (Windows 10)
This is the part where I need help - I think I'm supposed to install Homebrew, but even if I follow the instructions on their website I can't get it working properly. It's installed but as soon as I close & reopen the terminal, it throws zsh: command not found: brew. The commands I'm used to - php artisan xyz or npm run watch don't work
Do you guys have some guide or step-by-step tutorial of what should I do in order to get my Laravel&Vue git project up & running on a localhost?
brew is installed in /usr/local/Homebrew/bin/brew (symlinked to /usr/local/bin/brew). Make sure /usr/local/bin is in your PATH, so that brew and newly installed Homebrew packages are available on the command line. This is typically setup by the ~/.zshrc file.
Troubleshooting steps:
Edit $HOME/.zshrc.
If export PATH is not found, add the following line. The important part is to ensure /usr/local/bin is present (and that :$PATH is last) to give it higher precedence. If the export PATH line exists, but commented, uncomment it.
export PATH=$HOME/bin:/usr/local/bin:$PATH
Restart your shell. .zshrc is loaded automatically at shell startup.
Check for brew with the which command:
$ which brew
/usr/local/bin/brew
Update
This suggestion here fixed my issues: https://stackoverflow.com/a/66521797/9682588
So, what I did was:
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile

Truffle is installed but macOS cant find commands for any blockchain packages

[I opened terminal, I ran touch ~/.zshrc, then I downloaded nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Once that was done, I chose nvm install 15.4.0 because it's the latest version. Woo whoo, it downloads. Everything is working great... I can even install truffle... I run that command. I type in truffle --version.. will you look at that.. it works... Okay, lets try running all of these same commands in a new Terminal. No. none of them work. Nothing works. I reinstall, over and over again. Still wont work. I touch the zshrc file and try doing it with bash instead, but why would I download truffle and nvm twice? why won't it run normally if I downloaded it without any issues. WHat's the problem here?
]1

Mac OSX Terminal not Recognizing installed CLI Tool

I'm trying to literally download and run the ElectronNet demo (found here). I install the CLI tool, which appears to be accomplished successfully, but when I try to use the tool, terminal does not recognize it. Shown below:
% dotnet tool install electronnet.cli -g
Tool 'electronnet.cli' is already installed.
%electronize start
zsh: command not found: electronize
What could be going on here?
I guess it's something with your path&zsh,
if you try:
~/.dotnet/tools/electronize start
is that work for you?
If so, you can fix your path by editing ~/.zshrc, add this:
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet/bin"
and source the file by running: ". ~/.zshrc"

How to put psql on the path when using Postgres.app on OS X?

I've installed Postgres93 on my Mac. I can open the application, and "Open psql" through the app which opens up a command line interface with psql.
However, when I type $ which psql nothing is returned. The installation path is /Applications/Postgres93.app. How do I make $ which psql show the correct result?
Mac OS X - Mavericks
PostgreSQL package, I'm not as sure about. I went here and downloaded it - http://postgresapp.com/
I just had postgres installed and was not able to run the psql command until I ran the following command in my terminal:
export PATH="/Applications/Postgres.app/Contents/Versions/9.5/bin:$PATH"
Now the terminal knows where to find postgres when I use the psql command.
Remember to replace the version number '9.5' with your current version.
I had the same problem with nothing showing for the which psql command till I run the command below to resolve it. The command provided below is just a little tweak of what has already been provided by others here. The only difference is, instead of providing a specific postgres version number in the command, you can simply tell postgres to use the latest postgres version by simply running the following command:
export
PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
And now my terminal was able to find the path to postgres when I run which psql.
Hope this helps.
On macOS Mojave these instructions work well:
If your Postgres has not been installed yet, I suggest you use the great "brew" package manager from here https://brew.sh/ :
$ brew cask install postgres
or you can install it usual way from the website
Put this to the bottom of your ~/.bash_profile file:
export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:${PATH}"
Restart your terminal or restart your ~/.bash_profile directly with the command:
$ . ~/.bash_profile
Verify your installation:
$ psql --version
** Edited: to include a permanent fix, not just during your current session. **
I had this same problem, and also found a clear answer lacking in the docs.
To fix:
Download the new app, and follow the instructions to move it to the Applications folder
Add the new bundle to your path by typing the following in your Terminal (version number specific - mine is 9.4):
PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
To fix the issue on a permanent basis, run the same line but with export in front:
export PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
It appears that you installed Heroku's Postgres.app, which is a tool intended for throw-away testing and development. Add the contents of the bundle to your PATH by following the instructions in the Postgres.app documentation - see "command line tools".
On macos mojave i've added the following line on my ~/.profile :
export PATH=$PATH:/Library/PostgreSQL/10/bin
the psql command line client lies into this folder. i've used the enterprisedb installer.
I just experienced the same problem, and solved it by adding export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin to .bash_profile. Note that this line is version-specific, so be sure to check this line against your current version of Postgres.app.
Using Mac OS Monterey, the latest Homebrew (3.4.0) and postgres#13.
I was able to add psql to the path by using -
export PATH="/opt/homebrew/Cellar/postgresql#13/13.6/bin:$PATH"
Replace #13 and 13.6 with your version.
The latest homebrew install location seems to be /opt/homebrew/*
I'm using catalina 10.15.3 and I had the same issue after installing psql using homebrew. Then I noticed, homebrew mentioned
==> libpq
libpq is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.
If you need to have libpq first in your PATH run:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
So, I ran 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile and psql was added to my path
In Mac, there is a SQL Shell application already under /Applications/PostgresSQL
try that
Also, you can run /Library/PostgreSQL/11/scripts/runpsql.sh
In my case, I installed Postgres12 and had the same issue. I had to look out for the location of my bin folder. It happened to be in /Applications/2ndQuadrant/PostgreSQL/12/bin. So I had to run export PATH="/Applications/2ndQuadrant/PostgreSQL/12/bin:$PATH" in my terminal and restart the terminal. That solved it.

Xcode is not currently available from the Software Update server

I have problems with my macport after update to OS X 10.9.
I try to follow this manual https://trac.macports.org/wiki/Migration to fix them.
But when I install Command Line Tools:
xcode-select --install
I get message
Can't install the software because it is not currently available from
the Software Update server.
Meanwhile I successfully updated my other machine to OS X 10.9. and installed command-line tools with no problems, so they must be available.
What is the problem here?
You can download the command line tools for OS X Mavericks manually from here:
https://developer.apple.com/downloads/index.action?name=for%20Xcode
For OSX 10.11 or more you can download from here https://developer.apple.com/download/more/.
(The link in the accepted answer doesn't display command line tools for El Capitan (OSX 10.11))
If you are trying this on a latest Mac OS X Mavericks, command line tools come with the Xcode 5.x
So make sure you have installed & updated Xcode to latest
after which make sure Xcode command line tools is pointed correctly using this command
xcode-select -p
Which might show some path like
/Applications/Xcode.app/Contents/Developer
Change the path to correct path using the switch command:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
this should help you set it to correct path, after which you can use the same above command -p to check if it is set correctly
I faced same problem of Can't install the software because it is currently not available from the Software Update Server. You may try following steps instead to make the Software Update initiate update for the Command Line Tools.
Check if Command Line Tools Update is mentioned in your list of softwares to be updated by using following command: softwareupdate -l
If Command Line Tools Update is not mentioned in that list, then manually make it part of the list using following command which will create a temporary file: sudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Verify that the list now has the Command Line Tools mentioned by running softwareupdate -l again.
Now, press Cmd+Space to initiate Mac's Spotlight Search. Search for Software Update. Start the Software Update.
That will show you following kind of dialog for installing the Command Line Tools. Install away the update and be merry. :)
Remove the temporary file created in Step 2: sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress.
I deleted the command tools directory given by xcode-select -p due to npm gyp error.
xcode-select failed to install the files with the not available error.
I ran the Xcode application and the command tools installed as part of the startup.
npm worked.
However this didn't fully fix the tools. I had to use xcode-select to switch the path to the Developer directory within the Xcode application directory.
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
MacOS catalina.
I just got the same error after I upgraded to 10.14 Mojave and had to reinstall command line tools (I don't use the full Xcode IDE and wanted command line tools a la carte).
My xcode-select -p path was right, per Basav's answer, so that wasn't the issue.
I also ran sudo softwareupdate --clear-catalog per Lambda W's answer and that reset to Apple Production, but did not make a difference.
What worked was User 92's answer to visit https://developer.apple.com/download/more/.
From there I was able to download a .dmg file that had a GUI installer wizard for command line tools :)
I installed that, then I restarted terminal and everything was back to normal.
I know this is an old post but I also ran into this problem today. I found out that when I executed sudo softwareupdate -l the Command Line Tools were listed as an update, so I installed them using sudo softwareupdate -i -a.
This error can occur if you are using a software update server which doesn't host the required package.
You can check this by running
defaults read /Library/Preferences/com.apple.SoftwareUpdate
and seeing if you have an entry called CatalogURL or AppleCatalogURL
You can point back at the Apple software update server by either removing this entry or using the command
sudo softwareupdate --clear-catalog
And then run the command line tools install again.
I got the same issue on MacOS Catalina.
I think I identified the root cause: I have switched the default Apple ID account and the new one was not activated as a Developer account. When I ran the xcode-select --install command, I got the same error as stated in the issue description.
After reading this post on stackoverflow, I went on https://developer.apple.com/downloads and I was asked to accept Developers terms. I think it enabled my account as a developer one. Then, I tried to run xcode-select --install again and it worked.
The command
xcode-select --install
proposes 3 options: Get Xcode; Not Now; Install.
When I choose to get full Xcode the command finished successfully. It took a while, but this way I was able to complete all macports migration instructions.
Once you get the command line tools loaded as described by Nikos M in his excellent answer above you will need to agree to the gcc license and if you are using ruby gems you may need to link llvm-gcc as gcc-4.2.
If you do not do these the gem install will report "You have to install development tools first." after you have already installed them.
The steps are:
sudo gcc
sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2
The gcc must be run once under sudo so Apple can update their license info, you don't need an input file, it will update the license before it checks its arguments. The link is needed so that ruby 1.9 can find the compiler when building certain gems, such as the debugger. This may be fixed in ruby 2.x, but I'll cross that bridge when I get there.
I had to run Xcode.app and agree to the License Agreement
Setup: Brand new MacBook with Mavericks, then brew install and other c/l type things 'just work'.
I solved this by going to the App Store and installing Xcode.
It was a pretty large 11GB install, so this is probably overkill. But, as a last resort, it seems to have solve my issues. In the middle of the installation (well around 10GB), Mac OS told me there was an update to Command Line Tools for Xcode. Performing this installation won't fix anything until Xcode is fully installed.
Once the install is done, it should start working (after you accept the license agreement).
Command + Space
Search for Xcode
Open it and accept license
Then run again from terminal xcode-select --install
Had the same issue and was getting the same error. When i ran xcode-select -p, it gave output as /Library/Developer/CommandLineTools. So that means xcode was already installed in my system. Then i ran steps as given on this answer. After which any command which required xcode ran successfully.

Resources