I've installed a fresh copy of High Sierra today (After resetting my whole mac) so now I am at the point of installing all things related to programming, like the Laravel installer for now.
I have problems with installing the laravel installer and with the path I suppose.
I know there are a lot of questions a bit similiar to this but for some reason I haven't found the right answer yet.
So as the documentation of Laravel said I installed composer and that works just fine. After that I installed the Laravel installer with composer. I placed the command(?) for my path in the .bashrc file but after a re open of my terminal the command Laravel was not found. I knew from previous times this thing was a pain in the ass and I am also not very familiar with all those things in the command line so this is kinda hard for me.
What I did:
1) I installed composer. After that, I did mv composer.phar /usr/local/bin/composer in my terminal. Also I did mkdir -p /usr/local/bin because i had a fresh install so those directories were not found of course, because they didn't exist.
2) After that I ran composer global require "laravel/installer" in my terminal. This was all going great.
3) Last step was to do this thing with the PATH. I still don't know if I did this right. What I did was nano ~/.bashrc and then added export PATH=~/.composer/vendor/bin:$PATH to this file. This did not work, so I still can't use Laravel .. in my terminal. I don't know much about this source command but when I do source ~/.bashrc I can use this Laravel command but when I open a new tab or window I can't use it anymore.
4) Besides export PATH=~/.composer/vendor/bin:$PATH in the .bashrc file I also tried export PATH="$HOME/.composer/vendor/bin:$PATH" in that file. that doesn't work either.
Is there someone that can help me out? Good to know is that I just installed a fresh copy of OS and did nothing besides installing some normal programms. Laravel/Composer were my first things with the terminal.
It might be that your terminal program is set to create a login shell, which doesn't source ~/.bashrc
Try adding this to ~/.bash_profile
[[ -f ~/.bashrc ]] && . ~/.bashrc
Related
So simply put. I did an in-place update from 10.10.5 to 10.11.1 recently and just discovered that my composer package manager is no longer working.
I've tried a number of solutions and have it installed into the correct directory, but my alias 'composer' which was set globally is now not able to find the composer file.
Following the steps as always
First, Download
curl -sS https://getcomposer.org/installer | php
Then move
sudo mv composer.phar /usr/local/bin/
Then update bash_profile
vim ~/.bash_profile
Finally add alias
alias composer="php /usr/local/bin/composer.phar"
And my end result, when calling composer is this
Could not open input file: /usr/local/bin/composer/
Any ideas why this might happen?
Found the answer by talking to someone on reddit.
///
First off, try going to the composer file in /usr/local/bin and double-click it. It should open up in a new Terminal window. This should at least confirm that the file can be executed.
Second, you shouldn't need to have an alias to use composer. You merely point your path to it like this:
export PATH="~/.composer/vendor/bin:$PATH"
If you have any other path variables you'll just attach a colon to the end of it like so:
export PATH="/usr/local/php5/bin:~/.composer/vendor/bin:$PATH"
Hope this helps.
I was following these instructions to install homestead on my Mac
http://pastebin.com/48PHSNC2
Homestead installed properly, but when it initialized, it didn't create a Homestead.yaml file. I have no idea how to reinitialize homestead or fix this. Reading through the installation guide Laravel gives you, it suggests using $ bash init.sh to create the .yaml file... unfortunately, this apparently doesn't exist for me either.
I used the composer command to install the CLI:
composer global require "laravel/homestead=~2.0"
Any ideas? I'm stumped...
I ran into a similar issue using Homestead 2.X (I dont care for Homestead 3 ATM).
basically do the following:
find the bash_init.sh file by running sudo find / -name init.sh
cd into the directory it's in, mine was in /Users/me/.composer/vendor/laravel/homestead/init.sh
make it executable, by running chmod +x init.sh
run ./init.sh
...
profit!
You can generate manually by clone git clone https://github.com/laravel/homestead.git Homestead. This will generate homestead.yaml file. Open and edit and change the parameters to fit your system configuration. For further reading
https://dev.to/ko31/installing-laravel-homestead-on-macos-5910
I'm following this tutorial. I need to install Laravel but I can not get pass through Composer.
Running a line like curl -sS https://getcomposer.org/installer | php is relatively easy.
I also moved it: sudo mv composer.phar /usr/local/bin/composer. I have added the PATH (export PATH="$PATH:~/.composer/vendor/bin”) by editing my .bash_profile, but no results. I can't get it to work.
Is there anyone who knows how to install composer properly?
Did you execute command?
export ~/.bash_profile
after editing this file (also reboot can be as alternative)?
Of course as quick hack you can use either php ~/.composer/vendor/bin/composer
or write hardcoded alias in ~/.bash_profile:
alias composer="~/.composer/vendor/bin/composer"
and after editing do not forget to execute export ~/.bash_profile
also check permissions if your current user can execute this file
I really appreciate all the answers above. They all helped to a final answer.
It seems that creating an alias inside the .bash_profile with the right path was solution. As of right now I can type "composer" and it will run.
The route points directly to where my composer.phar is currently installed.
A reboot was necessary as well.
alias composer="usr/local/bin/composer/composer.phar"
I am trying to setup my first laravel project. I am running XAMPP for Linux (LAMPP) and I installed composer in /opt/lampp/bin/php.
I then cd /opt/lampp/htdocs
I then run: /opt/lampp/bin/php composer.phar create-project laravel/laravel new_proj --prefer-dist
Everything seems to be going great for the install then I get
Script php artisan optimize handling the post-install-cmd event returned with an error
[Runtime Exception]
Error Output: sh: 1: php: not found
I have PHP 5.4.
I think I understand the error but I don't know Laravel well enough to solve this. I have searched for this and can't seem to find an answer.
Also I can't seem to find a good starting point for trying to install this on XAMPP for Linux (LAMPP). Any help here would be greatly appreciated.
Problem was that I did not specify
/opt/lampp/bin
in my Path so it could not find PHP and more specifically it could not find the version of PHP that I was using in LAMPP. So I added
Path=$PATH:/opt/lampp/bin
to my ~/.bashrc file then I was able to successfully install laravel. Next issue that came up after that was setting permissions on the appropriate folders.
Permissions Problem, See Below:
Set permission for your project folder: sudo chmod 755 -R laravel_proj_name
Set permission for your project storage folder:
sudo chmod o+w -R laravel_proj_name/app/storage
Refresh Page, Good to Go!
I think the problem is that the PHP CLI binary is not in your path. Try adding it to your path or putting a symbolic link into /usr/bin or some other appropriate place.
hi i start working Laravel 4, i have finished the installation process with composer, but when try to use artisan it always give a message
Laravel requires the Mcrypt PHP extension
i have checked with php_info() it shows me Mcrypt PHP extension is enabled, after searching on web i have found some solutions, if i apply those then composer stops working viceversa . i am using XAMPP for development if i use which php command in terminal it show me path /usr/bin/php but my development php is in /Applications/XAMPP/xamppfiles/bin, i have extend the $PATH using .bash_profile
export XAMPP_PHP=/Applications/XAMPP/xamppfiles/bin
export PATH="$XAMPP_PHP:$PATH"
after this artisan start work great but composer stops its working if i type composer command in terminal it show ???? output, now i want composer, php and artisan work perfect just looking for good settings
I solved this problem with a workaround. Instead of changing the $PATH variable, on /usr/bin/ I created a symbolic link to XAMPP's PHP:
cd /usr/bin/
ln -s /Applications/XAMPP/xamppfiles/bin/php phpx
'phpx' is the name I gave to run php on XAMPP (pick the name you prefer - obviously it needs to be different than 'php'). This way I can run artisan using 'phpx' (XAMPP version) which has mcrypt. For example:
phpx artisan key:generate
And if you need to run composer, you run php (mac version):
php composer.phar install
It's a workaround, I'm not proud of it, but it's working.
The best solution would be to install mcrypt on your mac (use this tutorial), mysql and use mac's php. But as a lot of developers (including me) still rely on XAMPP, this workaround may be enough for testing.
If it outputs ???? it most likely means you have detect_unicode = On in your php.ini. This must be off because it breaks phar files.