📜 ⬆️ ⬇️

Personal experience Web development in Mac OS X

Hi Habr!

Based on this article

As a web developer who chose Mac OS X as the main working tool, I was faced with the problem of setting up the necessary environment. By the longstanding habit of working with servers on Linux, my hands reached into the console in order to put everything in, but stopped - wait, wait, but why should I turn this OS into another Linux server? I have enough of this shamanism with the console on the servers, thanks. We will use embedded components as much as possible.

Web server


Apache is pre-installed on Mac OS and more than enough for local development.
A little trick - if you don’t need a virtual host, this trick helps a lot:
/etc/apache2/extra/httpd-userdir.conf 

 <Directory "/Users/*/Sites/"> Options Indexes Order allow,deny Allow from all </Directory> 

It remains to throw the project in ~/Sites/%_% and open it in the browser localhost/~%user_name%/%_%
In the extreme case, if you need a complete copy of the production environment, you can always install Vagrant .

Php


PHP is preinstalled on Mac OS. If its version suits, then simply enable the loading of the php5_module module:
 /etc/apache2/httpd.conf 

 LoadModule php5_module libexec/apache2/libphp5.so 

If you are not satisfied, then you can install PHP according to the manual from here php-osx.liip.ch . This version will not replace the system version, it will find Apache itself and will generally be installed in / usr / local / php5 . Installation is extremely simple - one line in the console (example for PHP 5.5):
 curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5 

Mysql


You can install MySQL in several ways, for example, through Homebrew . But compile from source MySQL only because it allows the package manager? It seems to me that it is easier to take the DMG archive from the official site and install it. After installation, the MySQL tab will appear in the System Preferences:

')

FTP / SFTP


In addition to working on the main project, one has to be distracted and correct / finish something with clients. This is usually someone else's hosting with FTP access. So you need an FTP client. The choice fell on Cyberduck :


Why Cyberduck? Because it stores passwords in Keychain, translated into Russian, is free and supports FTP , SFTP , WebDAV , Amazon S3 , Google Cloud Storage and Rackspace Cloud Files .

MySQL client


Long chose the army between MySQL Workbench and Sequel Pro . By virtue of ease won Sequel Pro.


Why local application and not phpmyadmin or mysql in the hosting console? Because all the supervised databases are in one place and you do not need to open the console, SSH and remember the passwords in the task “see what's in the client’s database”. Yes, this is a remote connection and MySQL on the hosting is looking outside. But access via IP or SSH tunnel save the father of Russian democracy.
The program has a lot of opportunities, it is better to read on the official site.

Sublime text


Without it, nowhere. A little trick in the settings:
 { "open_files_in_new_window": false, } 

By default, it is set to TRUE and because of this Cyberduck opens new files in a new window, and not in a new tab of an existing window.

In addition, it happens that you need to quickly run a small piece of PHP code, and doing this in the IDE is not convenient. You can execute PHP code from Sublime Text by adding a new Build System ( Tools -> Build System -> New ):
 { "cmd": ["php" , "$file"] } 

Now press CMD + B and the result of the code will appear in the Sublime Text console.

Dash




This is a handy collection of documentation, here are its features:


Of course, you can still start singing the praises of touch gestures and full-screen applications, but this is beyond the scope of the article.

Source: https://habr.com/ru/post/220165/


All Articles