10

I'm trying to install Laravel Homestead in order to be able to test my Laravel projects locally.

I'm following this tutorial: http://laravel.com/docs/4.2/homestead

In the "Installing Homestead" part I followed the second step "Manually Via Git (No Local PHP)",I don't have any PHP installed locally and can't use Composer. (Wasn't PHP supposed to be installed as part of Homestead?)

I got to this part:

Once you have installed the Homestead CLI tool, run the bash init.sh command to create the Homestead.yaml configuration file:

bash init.sh

In command prompt I tried to enter the following command:

bash init.sh

I got the following error:

'bash' is not recognized as an internal or external command, operable program or batch file.

Then I tried to enter the same command in Git Bash, and I got the following error:

bash: init.sh: No such file or directory

When I tried to enter in Git Bash simply

init.sh

I got the following error:

sh.exe": init.sh: command not found

Maxim Laco
  • 545
  • 2
  • 7
  • 17
  • try to run this command from command line: mkdir -p ~/.homestead cp src/stubs/Homestead.yaml ~/.homestead/Homestead.yaml cp src/stubs/after.sh ~/.homestead/after.sh cp src/stubs/aliases ~/.homestead/aliases – xAoc Jan 14 '15 at 19:37
  • `mkdir -p ~/.homestead` results in `The syntax of the command is incorrect.` – Maxim Laco Jan 14 '15 at 19:44
  • If you are using Windows, try to specify full path C:\Users\UserName\.homestead – xAoc Jan 14 '15 at 19:52
  • First command worked. Second command: `cp src/stubs/Homestead.yaml D:/Homestead/Homestead.yaml` results in `'cp' is not recognized as an internal or external command, operable program or batch file.` – Maxim Laco Jan 14 '15 at 20:00
  • Copy its a windows cp command. Or better copy this files manualy. :) – xAoc Jan 14 '15 at 20:02
  • I copied all 3 files from src/stubs to that new directory. What did it accomplish? – Maxim Laco Jan 14 '15 at 20:07
  • Configure Your Shared Folders\Nginx sites etc... and vagrant up – xAoc Jan 14 '15 at 20:09
  • I simply executed init.sh in my Homestead folder, is that fine? Said "Homestead Initialized!". Should I modify the Homestead.yaml I have there? If not then why not? Why going through copying only some files from there to a new folder? – Maxim Laco Jan 14 '15 at 20:30
  • `chmod +x init.sh` and `./init.sh` – ShellFish Jan 14 '15 at 20:34
  • Sorry I don't understand you ShellFish – Maxim Laco Jan 14 '15 at 20:38

7 Answers7

12

I ran into this problem well. You need to hop into your terminal (I am on Mac.)

  • Type into your console: cd ~/Homestead
  • and to make sure you are in your newly generated Homestead folder (you can always click Finder > your home directory > Homestead to confirm it's where it should be),
  • then while in terminal simply type ls -- if it lists all of the files like Vagrantfile, composer.lock and bash init.sh, you should be in.

Once you know you are in the correct Homestead folder, it is now at that point in which you run bash init.sh

After doing this it now says Homestead initialized!

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user3430353
  • 141
  • 1
  • 6
8

.sh is a unix/linux script executable, that isn't recognized on Windows. There's a init.bat included in the package, but it isn't referenced in the tutorial.

Just run init.bat from the command line. It will copy the files to:

%HOMEDRIVE%%HOMEPATH%\.homestead
ρяσѕρєя K
  • 132,198
  • 53
  • 198
  • 213
James Durkee
  • 83
  • 2
  • 4
0

You need install Git Bash, and then run commands into Git Bash.

Yoel Monzon
  • 111
  • 5
0

Try init.bat that worked for me

Rami Nour
  • 2,035
  • 1
  • 14
  • 11
0

If the init.bat refused to work

Go to the Homestead folder. C:/Users/Computer Name/Homestead

You will see init.bat: double click to run it.

Problem solved.

Kingsley Uchenna
  • 580
  • 3
  • 15
-1

I found the answer you may be looking for. I was having the same problems with this. Just make sure at the end of bash init.sh you put a ;

So in the git bash cmd you will have this line

$ bash init.sh;

NewbieCoder
  • 111
  • 4
  • 15
-2

Just do it using sudo.

$sudo bash init.sh
Max Vollmer
  • 8,412
  • 9
  • 28
  • 43
doglabel
  • 61
  • 8