Install Golang and vim-plug vim-go on macOS Catalina

macOS Catalina didn’t have “go“, we need install it first.

So we download it at official website. and run "go1.14.4.darwin-amd64.pkg" installer file to install it.

View version

Make GOPATH and GOBIN to your want path.

Matthew is my Name.

OK. Go install finish.

Then. We install vim-plug and config plug "vim-go" and to install.

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Wirte to ~/.vimrc config vim-go plug

call plug#begin('~/.vim/plugged')

Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }

call plug#end()

In vim enter install commend to install plug

:PlugInstall

Waiting { 'do': ':GoUpdateBinaries' } option finish.

Then. Install all the necessary binaries

:GoInstallBinaries

When you see vim-go: installing finished! all done finish.

Install Oh my Zsh and Plugin on MacOS Catalina

Step 1. Install Oh my Zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Step 2. Install Plugin

  1. Zsh-syntax-highlighting
  2. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

  3. Zsh-autosuggestions
  4. git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Step 3. Activate Plugin

Edit .zshrc file:
vim ~/.zshrc
Add plugin to the list of plugins

plugins=(
...
zsh-autosuggestions
zsh-syntax-highlighting
)

Step 4. Source and start a new terminal session.

source ~/.zshrc

Set localhost environment (Apache, MySQL, PHP) on macOS Catalina

If you want to do a website development on your MacOS you also need to set localhost environment on your Mac.

In this way, you can create a website or application and then upload it to web hosting.

Here you can read how to set your Mac in order to have a development environment for your needs.

MacOS Version: 10.15.3 (Catalina)

Step 1. Turn on the Apache

Apache is already on your Mac, you just need to turn it on. Open the Terminal and type the following:

sudo apachectl start

User password will be requested, so you need to type in the password and then press Enter.

Then. Open your Safari (or any browser) and go to localhost.

If you see It Works! then the Apache is up and ok.

Screen Shot 2020-02-21 at 9.32.31 PM

Step 2. Turn on the PHP

PHP also goes with MacOs and in the 7.3.11 (Maybe) version if you are on the Catalina.

php -version

Here is how to turn on the PHP on your MacOS:

1: Open the Terminal and type in:

sudo vim /etc/apache2/httpd.conf

That command will in Vim editor open the file httpd.conf so press / to start the search in vim editor and then type in the “PHP” and press Enter. Search will place you into the part where are the PHP settings.

In front of the row that looks like this:

LoadModule php7_module libexec/apache2/libphp7.so

remove the # .

Screen Shot 2020-02-21 at 9.32.41 PM

Press :wq and then press Enter to save the settings and Quit.

2. In the Terminal type in sudo apachectl restart and press Enter, then type in your password in order to restart the Apache. PHP is now active so you can go further.

Step 3. Make Sites folder in Home

Open Finder, click on Go and go to Home. Create a new folder and name it as Sites. A folder will automatically get the Safari icon:

Screen Shot 2020-02-21 at 9.38.40 PM

When you finish that, go to folder Sites, and create a new file with the index.php name.

sudo vim ~/Sites/index.php

In that file place this text:

phpinfo();

Save that and open the Terminal. In Terminal type in the following:

sudo vim /etc/apache2/httpd.conf

Type / to search this file, and type in Library in order to search for Library. You need to see the following:

Screen Shot 2020-02-21 at 9.44.20 PM

Now, in both rows, edit the existing:

/Library/WebServer/Documents

into:

/Users/Matthew/Sites

Save the changes. And type:

sudo apachectl restart

Open the Safari and go to localhost address. You need to see the following from the image below. This page says that your index.php file serves the information that you enter to this file:

Screen Shot 2020-02-21 at 9.48.07 PM

Step 4. Install the MySQL

This is how to install MySQL on MacOS:

1: go to https://dev.mysql.com/downloads/mysql/

2: Click on the download button to download the DMG package for MacOS. This will open the page, and you can click on No thanks, just start my download.

Screen Shot 2020-02-21 at 9.50.54 PM

3: Run the installation of this file. Pay attention to enter the Root password for MySQL when installation wizard requests that. Root password can be any by your choice. Check in the Use Legacy Password Encryption. Keep in mind that this is not your Mac password, but a new one for MySQL.

4: Afer the installation, go to System Preferences and search for MySQL. You need to see the following:

Screen Shot 2020-02-21 at 9.56.00 PM

5: Connect now some tools with MySQL. For the host enter 127.0.0.1, for the username enter root, and for the password enter password for the MySQL.

Screen Shot 2020-02-21 at 10.02.09 PM

6: After you connect, Create new database test:

Screen Shot 2020-02-21 at 10.07.34 PM

7: Open the ‘test’ database, Create test_tableFor the id enter a message, for the Type choose Varchar(255).

Screen Shot 2020-02-21 at 10.25.37 PM

8: Write “Hi MySQL” for the message.

Screen Shot 2020-02-21 at 10.34.15 PM

9: Go back to your index.php file in the Sites folder and change the content of that file with the following content (or just add), but pay attention to password-goes-here, database-name, table-name-from-database and replace that with your data:

<?php
 $con = new mysqli("127.0.0.1", "root", "xxxxxxxxx", "test");
 $message = $con->query("SELECT message FROM test_table")->fetch_object()->message;
 $con->close();

echo "$message <br/>";

phpinfo();
 ?>

Open the Safari and go to localhost:Screen Shot 2020-02-21 at 10.58.47 PM

Done!