Install of Laravel Valet with Composer is giving a Command not Found error in Mac OS - composer-php

Currently, I am in the process of installing Laravel Valet for the purpose of using it to locally develop with Kirby CMS.
I am following these instructions, once I try to install Valet I get a "command not found" error. After looking at other threads I attempted to find my device's Path using this code:
echo $PATH
In response I got this:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/tohumakind/.config/composer/vendor/bin:/Users/tohumakind/.composer/vendor/bin:/Users/tohumakind/.composer/vendor/bin:/Users/tohumakind/.composer/vendor/bin
I wasn't sure what to do in regard to installing Valet? It looks like Composer is installed in my User folder? There's only one user on this device. Do I need to move it Composer to a different part of my computer?
I tried using this line, as recommended in a different thread, but it didn't do anything to solve the 'command not found issue':
export PATH=$PATH:~/.composer/vendor/bin

In 2019 Apple has replaced bash with zsh as the default shell in macOS Catalina and later. To add path to your zsh shell, this command should work:
echo "export PATH=$PATH:$HOME/.composer/vendor/bin" >> ~/.zshrc
Make sure to restart your terminal for changes to be applied.

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

laravel command not found in mac os catalina

I am using Mac OS Catalina and I have already installed composer and laravel successfully. However, when I want to create a new laravel project via the terminal, it says zsh: command not found: laravel. Is this an operating system related issue?
Consider me a newbie, I'm not too sure what I have done wrong. Does anyone know how do I fix this?
This is likely due to not having Composer's vendor/bin directory in your path. You can add it to your path by running the code below.
You need to find out where composer is installing the vendor binaries first. This is usually in ~/.composer/vendor/bin or ~/.config/composer/vendor/bin.
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.zshrc
source ~/.zshrc

Setting up React Native on Mac

I'm trying to install React Native on Mac but I'm not able to get past the first step.
npm install -g expo-cli
This seems to work but when I run the next step expo init AwesomeProject I'm getting this error.
-bash: expo: command not found
I also do not have a .npm-global folder. I'm running npm 6.13.4 on Mac OS X 10.15.2.
This might be a local environment issue.
Your computer should know where to look for the commands you're using, it's likely that your mac is not looking for the correct folder.
In order to expo command works, you must have /Users/yourUser/.npm-global/bin in your $PATH commands.
Open your global bash_profile file vim ~/.bash_profile.
add export PATH=$PATH:~/.npm-global/bin.
Save the changes, and right after in your command line:
source ~/.bash_profile
Now you can try the command again!
Important Note: .bash_profile will run only on login shells. For non-login shells, you would need to create or edit .bashrc with this line above.

change bash_profile not working

I am working on Mac El Capitan. I have MAMP Pro installed. I am attempting to install composer. Part of the process is making it accessible globally. I have gone in and done vim ~/.bash_profile and added: export PATH=/Applications/MAMP/bin/php/php7.0.0/bin:$PATH
I am using PHP 7.0.0. However when I save and exit (escape :wq) and then run which PHP it is still pointing to the original folder. I have exited out of the terminal window and come back in. I have also run source ~/.bash_profile. Still the which php version points to /usr/bin/php
Any suggestions for what to try next?
This solution worked for me except I ended up putting composer in an apps folder rather than in my usr/bin.
telliott.io/node/969

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.

Resources