Skip to main content

Mac: how to clear cache

Clear DNS Cache

The DNS (Domain Name Service) cache on your Mac helps browsers locate and connect to web addresses quickly. If your browser Safari or Chrome still fails to load websites, this can be the result of an obsolete DNS cache may be causing the issue. In this instance you want to focus clearing the cache.  Using Terminal or iTerm2 enter the following command:

sudo killall -HUP mDNSResponder

 

Changing git push from passphrase

Changing git push from passphrase?  There are several ways to tackle this step.  I'm going to focus one of these steps.

From your web directory root, look for your .git directory.  Then open the .git...

cd .git

Next using your shell prompt (iTerm2), view the contents of the config file

vim config

Presently the config file looks like the following

xdebug error

xdebug - failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 45: unknown instruction: ZEND_EXTENSION=XDEBUG.SO

 

How I got here

Running the following Docker command

docker-compose up

Generated this output:

env: php: No such file or directory

In terminal I ran a regular command - compose update.  Something I've completed thousands of times previously.  However, this time I received the following response:

env: php: No such file or directory

 

Docker - creating a container / image

Create and push to Docker Hub

Creating your own custom image... you need to have a Docker ID.  Not sure, well most likely you created it to download Docker Desktop.  If you don't have one, go to Docker and sign up.

In your  text editor create a file called Dockerfile in the same directory you want to have as your local site. No extension, just Dockerfile. Paste in this code and save the file:

Updating Composer

Running composer on a server... when running the command composer update, screen would error out.  In the site directory, composer would show 

composer --version
Composer version 1.10.24 2021-12-09 20:06:33

Whereas, the commnd

/opt/plesk/php/7.4/bin/php /usr/lib64/plesk-9.0/composer.phar --version

Composer version 2.2.5 2022-01-21 17:25:52

Ok, so composer on the server is running 2.2x.  But on my site directory, 1.x

Resetting Docker

Resetting Docker is basically following the start parameters.  All containers removed -

No containers running

Try running a container: Copy and paste this command into your terminal

docker run -d -p 80:80 docker/getting-started

Unable to find image 'docker/getting-started:latest' locally
latest: Pulling from docker/getting-started

 

Adding a progressive touch of automation to my scripts

This page will be a progressive outline of moving those regular run scripts that really need to be automated.  Or triggered by a keyword.

These scripts are rsync commands

 

The initial scripts

production environment

How to switch users in Ubuntu and other Linux

It is really simple to switch users in Ubuntu or any other Linux distribution using the terminal, iTerm2 or your go to shell program.

All you need to do is to know the username and its account password and you can switch users with su command:

su another_username

You’ll be asked to enter the password of the user you want to switch to.

 

Install iTerm2 and integrate zsh

 

Z shell (Zsh) is a Unix shell built on top of bash (the default shell for macOS) with a large number of improvements.

In this article, I'll run through how to configure iTerm2 with ZSH and its dependencies.

 

Step 1: Install Homebrew

Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple’s macOS.

Subscribe to Terminal