Learning and understanding Laravel, the PHP framework for web artisans can greatly improve your PHP development experience and actually make it fun, but just concentrating on the things that matter most.
Laravel takes care of all the boring lower value cruft work a developer has to go through just to get a typical site up and running.
It really is an awesome framework, however, for a new developer to get it installed can be somewhat intimidating and there are so many tools and components that come along with it, that things can get a little confusing.
Although the documentation on Laravel is quite extensive and can really help to get you working with the framework, Ironically we have found that the documentation to get it all installed and working can be a little confusing and in some areas lacking.
In this post, we hope to address some of these issues help you get up and running with Laravel on Mac OSX .
Table of contents
I frequently need to copy the path to a file on my Mac or on a server, so that I can include that path in documentation or in a support email with a customer. Here’s how to do it: 1. Select the file you want in the Finder. Choose File Get Info (command-i) 3. Select the full path next to. When you’ve got loads of files — hundreds or even thousands isn’t unusual after a couple years using the same Mac — it can be difficult to get the correct file path. We attempt to solve this problem in this article for those tired of looking for files and file paths on a Mac. The AutoRecovery folder is a hidden folder, so you probably won't see it if you just try to navigate to it in Finder. Use the Go To Folder tool and enter the full path to get around this. If you close a file and click Don't Save, the AutoRecover file will be deleted because Office assumes that everything is ok and the AutoRecover file isn't needed. You can select the path to the file's parent folder in an info window and copy it. Screenshot by Topher Kessler/CNET To copy the file path of a file or folder as a text string that you can paste.
- How to Install PHP 7.2 on Mac OSX
- How to install Composer on Mac OSX
- How to Install Laravel on Mac OSX
- How to Add Laravel to Path on Mac OSX
- What is PATH?
- How to Edit your laravel PATH on Mac OSX
- Approach 1
- Approach 2
- Example of using Laravel new
- Install Laravel Homestead
- Configure Homestead Per Project
How to Install PHP 7.2 on Mac OSX
The best way to set up a development environment or even to manage the packages installed on Mac OSX is to
A word of caution though HomeBrew
If you have Homebrew installed, installing PHP is very simple, in the example below we will be installing PHP 7.2, which at the time of writing is the most current version.
PHP 7.2 is now the default in HomeBrew
If you want to have the ability to step through and debug your PHP applications you will need to install
xdebug which you will have to do using
PECL. PECL is a repository of PHP extensions which provides all known extensions and hosting facilities for downloading and development of PHP extensions.
Full Instructions to configure PHP 7 & Xdebug on Mac OSX
How to install Composer on Mac OSX
In order to install and easily use the Laravel framework, we will need to install
If you would like to install composer without making use of Homebrew you can so by
if you are not using HomeBrew you can install composer using Curl
Once the install has completed you can test it out by simply executing
How to Install Laravel on Mac OSX
We can now install Laravel using composer we will add it to the global composer
We can also generate new Laravel web applications using
How to Add Laravel to Path on Mac OSX
The Laravel Documentation refers to an alternate method of creating a new Laravel project by using,
laravel new but it requires an additional configuration step to make it work.
Make sure to place composer’s system-wide vendor bin directory in your
$PATH so the Laravel executable can be located by your system.
In my opinion, this does not clearly explain what this means or provides sufficient detail on how to do this.
What is PATH?
*nix Operating Systems and Microsoft Windows use Environment variables hold values related to the current environment.
PATH is an environment variable which is used for specifying a set of directories where executable programs are located.
In general, each executing process or user session has its own PATH setting.
How to Edit your laravel PATH on Mac OSX
There are 2 approaches you can take to edit your
PATH on MAC OSX
Using your terminal window, open
$HOME/.bash_profile, using any Text editor of your choice. Typically using either nano or Vim.
In this example, I will use nano
You can just copy and paste the following commands towards the end of the file –
CTRL + X to exit and save the file.
You will then also need to refresh your current terminal window with updated bash_profile.
If you want to edit
bash_profile all in one line you can do so by :
You will then also need to refresh your current terminal window with updated bash_profile.
Once you have completed either of the steps above you can now create new projects using commands
laravel new [project name].
File Path For Microsoft Edge
Example of using Laravel new
File Path For Desktop On Mac
We can create a new project named notepad using
laravel new notepad.
Change into the new notepad directory
cd notepad and start the project
php artisan serve
Install Laravel Homestead
Laravel Homestead is a pre-packaged Vagrant box that provides a development environment without you having to install everything on your local machine. Enabling you to create a complete environment for your Laravel application.
In order to install this, you will need two additional components
- Virtual Box –
brew install caskroom/cask/virtualbox
- Vagrant –
brew install caskroom/cask/vagrant
After you have completed the installation of the above you can install Laravel Homestead by running the following:
Show File Path Mac
It will take some time for the installation to complete, usually anywhere between 5 – 15 minutes depending on your connection and MacBook processing power.
Once complete you will have the latest copy of a complete Ubuntu Lamp stack server set up, which you can directly SSH into. The project files on your local machine will be synced with the VM.
Once the installation of Homestead completes, you will need to create a
homestead.yaml file that will hold all the configuration for your VM.
Configure Homestead Per Project
Homestead is configured using a
YAML file, which contains configuration information regarding sites & files on your computer, databases to create etc. When you start a new project, you have to add an entry to this file and re-provision.
When using Homestead on a per-project basis, you keep this file with your project and it contains only that project’s settings. Enabling you to quickly clone a project if it’s under source control, and quickly boot a Homestead instance for that project.
This is especially helpful when setting an existing project up on a new computer, as you don’t need to manually set up Homestead and configure it for your project.
To create a
Homestead.yaml for your project.
First, we need to add development
Laravel/Homestead dependency to our project.
To do this
cd into your project directory then execute:
Once complete we can now use this package to initialize files Homestead will require and create the
If you check your directory now you will notice a file,
We are now almost ready to run our project, all we need to do now is add an entry to our Host file for the website.
Then we add an entry for our new website and save the file
We can now just execute
vagrant up and browse to the test site http://sourcelink.test
You should now have the complete Laravel and homestead environment setup on Mac OSX. Go ahead and enjoy your new development environment and go create the next big thing.
- Gridsome – How to add Twitter Card to posts - September 21, 2020
- Gridsome – How to create a plugin - September 15, 2020
- Gridsome: Configuring Layouts and using slots - September 8, 2020
How To Find File Path For Mac
With new Mac OS updates more and more new features become available. Many users were waiting for the opportunity to copy the path to the file or folder in just a couple of clicks and after the release of the update named El Capitan it finally became possible. Previously, it was much more difficult to copy, despite the fact that such a need quite often arises during active work with the Mac OS operating system.
How to copy a path to a file or a folder in Mac OS
If you need to copy the full path to a certain file, first you are going to need to open this file in Finder. This can be done by clicking on the icon in the lower dock, or on the desktop in the top menu by selecting “File” – “New Finder window”. Another option to open a new window in the Finder is to use the keyboard shortcut Command + N.
File Path For Mac
After opening the Finder, go to the needed file. It is worth noting that you can use the search in the corner of the Finder window, for example, if you do not know exactly where the file is located.
After reaching the desired file you need to right-click on it to display the context menu. You can also call it if you hold down the Ctrl key and left-click on the file. In the context menu, locate the “Copy” line, which will contain the name of the file or folder that you want to copy.
Next, hold down the Option (Alt) button on the keyboard, and you will notice that in the context menu, where you had previously proposed to copy the file, the line “Copy … as a pathname” appears, followed by the name of this file or folder. You need to click on this menu item.
After that, the file path will be copied to your clipboard.
In order to insert this path in any application, just press the Cmd + V key combination on the keyboard.