change bash_profile not working - composer-php

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

Related

MacOS MAMP and php 8.1

I am trying to get MAMP runing with PHP 8.1 but what I see as latest version for MacOS is 8.0.8, is there a way to run 8.1 ?
I have gone thru many tutorials in which they explain on how to switch from one of the installed versions but I can't seem to find a way to install additional PHP versions.
following up relating to #Quink's answer
8.1.0 is available in the dropdown (not in the picture because I already downloaded it)
then quit and restart mamp
then you can find the folder by opening phpinfo page and seeing the path
not sure if this is needed, but at this point I copied the folder and pasted it in the main MAMP/conf directory where all the other PHP versions are
I was looking for this myself. I found out that the easiest way to do this is to start your trial version of the pro. There you have the option to download/ install the php8.1 version. After this I switched back to the basic MAMP and everything is working properly
Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
get latest php version i.e. 8.1 for now
brew install php
Verify php
which php
php -version
now go to to /usr/loca/Cellar/php, copy php version folder you want i.e. 8.1 for now
go to Application/MAMP/bin/php and paste this folder
rename your folder like others i.e. "8.1.10_1" to "php8.1.10" in my case
at this point you can quite the mamp and reopen it and you will see php8.1 version in your mamp php version's dropdown
now go to your terminal and
/Applications/MAMP/Library/bin/apachectl start
and you will see an error i.e. Syntax error on line 160 of /Applications/MAMP/conf/apache/httpd.conf... in my case
to resolve this go to /usr/local/lib/httpd/ and copy the "modules" folder
now past it in /Applications/MAMP/bin/php/php8.1.10/
YOUR MAMP IS ALL SET BUT if you try to reach phpadmin you will see an error, for that
go to /Applications/MAMP/bin/phpMyAdmin5 and edit config.inc.php.
Locate this text: $cfg['Servers'][$i]['host'] = 'localhost' and change it to ``$cfg['Servers'][$i]['host'] = '127.0.0.1'`
Restart your server.
HOPE THIS HELP YOU
This YouTube Video answers this perfectly, and then follow this SO answer
You might also want to change your local connection host from localhost to 127.0.0.1
PS: Copy /usr/local/Cellar/php/8.<version_number>/lib/httpd/modules/libphp.so to /Applications/MAMP/bin/php/php8.<version_number>/modules/libphp.so

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

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

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.

Keep getting: No such File or directory when I open the Terminal

Every time I open the terminal I keep getting this:
bash: /usr/local/Cellar/nvm/0.33.0/nvm.sh: No such file or directory
I have tried reloading. No idea why all of a sudden this has come up. Any guesses guys?
You need to update your nvm via homebrew:
brew upgrade nvm
I was getting the same error after I installed another NVM version manually (forgetting that I have had installed an older version via homebrew).
That resulted in a wrong path within configuration in your .bash_profile, .bashrc or any other similar file which gets started each time you run a new terminal window.
According to https://github.com/creationix/nvm#installation, look for something like
export NVM_DIR=~/.nvm
[ -s $NVM_DIR/nvm.sh ] && . $NVM_DIR/nvm.sh
This configuration is normally set while installing of NVM. I have had a wrong path in it, die above will work when your NVM resides in ~/.nvm
Hope that helps you.

Resources