macOS setup

macOS setup guide

  • dani

dani

5 min read

Disable the Dashboard in macOS

Working with multiple desktops and full-screen applications on a Mac, the Dashboard can be annoying. Gladly, there is a way to disable the Dashboard in macOS altogether.

The most-powerful feature of a Mac is working with multiple desktops and swiping through them using gestures. If you make heavy use of multiple use, the Dashboard may be annoying. Hereafter, I show you how to disable the Dashboard in macOS.

Disable the Dashboard

Just open the Terminal and copy & paste the following command to change your Mac configuration to disable the Dashboard:

defaults write com.apple.dashboard mcx-disabled -boolean YES

Restart the Dock process (owning the Dashboard) by killing it with the killall command:

killall Dock

The Dashboard should now be disabled. When you swipe with three fingers to the right (or scroll left) there should be no more Dashboard. The Desktop should bounce back instead.

Re-enable the Dashboard

To re-enable the Dashboard just inverse the configuration command:

defaults write com.apple.dashboard mcx-disabled -boolean NO

Kill the Dock process with killall again and the Dashboard is re-enabled.

Homebrew

Homebrew is a package manager for macOS that allows you to easily install third-party software and keep it up-to-date. If you have ever used Ubuntu, then Homebrew is much like aptitude (apt).

To install Homebrew, open the Terminal and copy & paste the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Homebrew installs all executable programmes in /opt/homebrew/bin and this path is not in the default executable path of macOS. To add the path for your user, you have to edit the file ~/.zprofile. The brew installation provides you two lines of Terminal commands to achieve this:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

This will add /opt/homebrew/bin to your user's PATH variable. You may also consider to add that path to the default environment.

To maintain Homebrew (update the list of available programmes and their versions and update the installed programmes) you may want to place a new script called brew-maintain.sh under /usr/local/bin with the following contents:

#!/bin/sh

brew update;
brew cleanup;
brew upgrade;
brew cleanup;

Once the script is place there, you can call it from the Terminal to maintain Homebrew at any time.

To turn off analytics (sending anonymous data) type the following command in your Terminal:

brew analytics off

Git

Git is a very powerful and useful version control system to keep track of changes in documents. This article shows how to install Git on macOS with Homebrew.

I found Git to be extremely useful when you write a LaTeX document like your thesis. You can then use Git to store the history of your files and you will never miss a reference.

To install Git, you can use Homebrew:

brew install git

Afterwards, you can check the Git version

$ git --version
git version 2.8.4 (Apple Git-73)

Xcode

Xcode is Apple's development environment for their operating systems macOS, iOS, tvOS, and watchOS. If you want to develop software for Apple products you need to install Xcode as development environment.

Xcode is free for Mac owners and available from the App Store. To install the latest Xcode just search Xcode on the App Store and click the install button.

After you have installed Xcode, install the command line developer tools (CLDT). Open a Terminal and type the command:

sudo xcode-select --install

The command sudo executes the subsequent command as administrator. Therefore you are required to enter your password after hitting the Enter key.

MySQL

MySQL is a famous open source relational database that is used widespread by websites to store data. For web development you may need a local instance of MySQL running. This article explains how to install MySQL on macOS with Homebrew.

MySQL is a famous open source relational database that is used widespread by websites to store data. For web development you may need a local instance of MySQL running. This article explains how to install MySQL on macOS with Homebrew.

brew install mysql

During the installation, Homebrew will output something like:

==> Summary
🍺  /opt/homebrew/Cellar/mysql/8.0.26: 304 files, 296.7MB
==> Caveats
==> mysql
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

To start mysql:
  brew services start mysql
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/mysql/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql

So, we need to follow the instruction printed by Homebrew and execute the two commands:

brew services start mysql
mysql_secure_installation

You are asked to enable the "validate password plugin" that ensures the password security:

$ mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:

You can make your choice. The setup will then ask you two times for a new password:

Please set the password for root here.
New password:
Re-enter new password:

In the next steps, just pick yes by typing y and hitting Enter until the setup finished:

By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : 
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) :
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : 
 - Dropping test database...
Success.
 - Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :
Success.
All done!

Congratulations! The setup is done. If you want to stop or start the MySQL server just type one of the following commands:

brew services stop mysql
brew services start mysql

If you want to remove MySQL check out my article on how to uninstall MySQL on macOS.

Apache with PHP, WordPress and PHPMyAdmin

See my blog post at ...

LaTeX

LaTeX is the standard in academic writing, especially for mathematical and natural sciences. LaTeX is open source software and also available for Mac.

To use LaTeX, the MacTeX distribution contains everything you need from the engine up to GUI editors. One way to get MacTeX is to just go to the download site and download the PKG file. The PKG file is an executable installer that installs the software on your Mac.

Another way is to use Homebrew to install the package. It pretty much does the same steps as you would do: download the package and install it. But Homebrew provides some useful meta commands to maintain the dependencies and the version. To install MacTex with Homebrew use the command from Terminal:

brew cask install mactex

Java

See my blog post at ...