Git on macOS, xcrun: error: invalid active developer path

After upgrading to macOS Big Sur 11, macOS Monterey 12, macOS Ventura 13, etc. Does it seem every upgrading macOS will cause the following error message for the git command? How to fix it? Terminal % git xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun Solution Open the Terminal, and run this …

Read more

VirtualBox running slow and lag on macOS, MacBook Pro

This article shows how to fix VirtualBox 6.1.* running slow on macOS, MacBook Pro with retina display. Tested with VirtualBox 6.1.22 macOS Big Sur 11.1 MacBook Pro (16-inch, 2019) Kali Linux, Ubuntu, Debian 1. VirtualBox with more memory, CPU, etc In VirtualBox, clicks on the Settings icon. 1.1 Increase based memory. 1.2 Increase CPU processors. …

Read more

Go to the parent folder on macOS

This article shows how to use a keyboard shortcut to access the parent folder or any item or folder on macOS. 1. Go to the parent folder. (Command + Up Arrow) In Finder, we can press Command + ↑ to access the parent folder of any item or folder. 1.1 For example, in Finder, this …

Read more

Go to a specified folder on macOS

This article shows how to use a keyboard shortcut to go to a specified folder on macOS. 1. Go to a specified folder. (Shift + Command + G) In Finder, there is no explorer to type the path you want to go. To fix it, we can press Shift + Command + G together to …

Read more

Install VirtualBox on macOS, the installation failed?

Try to install VirtualBox on macOS, and hits the error "The Installation failed."? P.S Tested with VirtualBox 6.1 and macOS Big Sur 11.1 Solution 1.1 Desktop, top menu, clicks Apple icon -> System Preferences… 1.2 Clicks on the Security & Privacy icon. 1.3 Clicks on the left-bottom lock icon, type password to unlock it. 1.4 …

Read more

Where does Homebrew install packages on Mac?

By default, Homebrew will install all packages in the directory /usr/local/Cellar/, and also creates symbolic links at /usr/local/opt/ and /usr/local/bin/ (for executable files). Terminal /usr/local/Cellar/ /usr/local/opt/ /usr/local/bin/ Terminal % brew -v Homebrew 2.7.2 Homebrew/homebrew-core (git revision 3c379; last commit 2021-01-11) Homebrew/homebrew-cask (git revision 40d45; last commit 2021-01-11) P.S Tested with Homebrew 2.7.2 and macOS Big …

Read more

How to install Java JDK on macOS

This article shows how to install Java JDK on macOS, Homebrew package manager, manual installation, and switch between different JDK versions. Tested with macOS 11 Big Sur Homebrew 2.7.4 JDK 8, 14, 16, 16 (AdoptOpenJDK and OpenJDK) Topics Homebrew install latest Java (OpenJDK) on macOS Homebrew install Java 8 (OpenJDK) on macOS Homebrew install a …

Read more

Mac OSX – Redirect .htaccess is not working ?

Here is the .htaccess file. /Library/WebServer/Documents/.htaccess # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /mkyong/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /mkyong/index.php [L] </IfModule> # END WordPress Solution Find the Apache config file in /etc/apache2/httpd.conf, make sure the following settings are configured properly : 1. The mod_rewrite.so is loaded. …

Read more

Mac OSX – where is default localhost folder?

On Mac OSX, the default localhost folder is located at /Library/WebServer/Documents P.S Tested with MacOS Sierra, 10.12.6 Find httpd.conf By default, Apache is enabled and installed in /etc/apache2/, inside httpd.conf file, find DocumentRoot to tell where is the default localhost folder. sudo vim /etc/apache2/httpd.conf # DocumentRoot: The directory out of which you will serve your …

Read more

How to edit hosts file on Mac OSX

Edit this file /private/etc/hosts. Terminal $ sudo nano /private/etc/hosts ## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 127.0.0.1 mkyong-mac 198.x.x.x linode-bot1 1.2.3.4 www.google.com References What is the difference between …

Read more

wget on Mac OS X

By default, there is no wget on Mac OS X. $ wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.9/bin/apache-tomcat-8.5.9.tar.gz -bash: wget: command not found On Mac OS X, the equivalent of Linux’s wget is curl -O $ curl -O http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.9/bin/apache-tomcat-8.5.9.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 49 9112k 49 …

Read more

How to Apache Ant on Mac OS X

In this tutorial, we will show you how to install Apache Ant on Mac OSX. Tools : Apache Ant 1.9.4 Mac OSX Yosemite 10.10 Preinstalled Apache Ant? In older version of Mac, Apache Ant may be already installed by default, check if Apache Ant is installed : $ ant -v 1. Get Apache Ant Visit …

Read more

Mac OSX – What program is using port 8080

By default, most Java web application servers are listening on port 8080, and it can easily cause the popular 8080 port conflict error. In Mac OSX, you can use sudo lsof -i :8080 | grep LISTEN to find out what program is listening on port 8080 : In terminal $ lsof -i :8080 | grep …

Read more

Mac OSX – What program is using port 80

In Mac OSX, you can use sudo lsof -i :80 to find out what program is using or listening on port 80 : In terminal $ sudo lsof -i :80 Password: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 12649 root 5u IPv6 0xede4ca21f607010b 0t0 TCP *:http (LISTEN) httpd 12650 _www 5u IPv6 …

Read more

Download JDK Source code for Mac OS X

The JDK source code is packaged in a src.jar, and should be in the JDK/Home folder. However, some JDK versions in Mac OSX didn’t include the source code or Javadoc. Try find it : sudo find / -name src.jar If you couldn’t find the src.jar, then get it from Apple developer website. 1. Download from …

Read more

How to install MongoDB on Mac OS X

A guide to show you how to install MongoDB on Mac OS X. MongoDB 2.2.3 Mac OS X 10.8.2 1. Download MongoDB Get MongoDB from official website, extracts it : $ cd ~/Download $ tar xzf mongodb-osx-x86_64-2.2.3.tgz $ sudo mv mongodb-osx-x86_64-2.2.3 /usr/local/mongodb 2. MongoDB Data By default, MongoDB write/store data into the /data/db folder, you …

Read more

How to set environment variables on Mac OS X

In Mac OS X, you can set the environment variables in one of the following files : ~/.bashrc ~/.bash_profile ~/.profile By default, Mac OS X does not has above files, you need to create it manually. $PATH example This example shows you how to set “mongodb/bin” folder to the existing $PATH environment variable. $ echo …

Read more

Maven $JAVA_HOME is not defined correctly on Mac OS

This article shows how to fix the Maven error JAVA_HOME is not defined correctly. Terminal $ mvn -version Error: JAVA_HOME is not defined correctly. We cannot execute /usr/libexec/java_home/bin/java Further Reading How to set $JAVA_HOME environment variable on macOS 1. $JAVA_HOME and macOS 10.15 Catalina, macOS 11 Big Sur On macOS 10.15 Catalina and later, the …

Read more

How to Set $JAVA_HOME environment variable on macOS

This article shows how to set the $JAVA_HOME environment variable on older Mac OS X and the latest macOS 11. Topics macOS release history What is /usr/libexec/java_home $JAVA_HOME and macOS 11 Big Sur $JAVA_HOME and Mac OS X 10.5 Leopard $JAVA_HOME and older Mac OS X Switch between different JDK versions Solution Steps to set …

Read more

Add color to the bash terminal in Mac OS X

By default, the bash terminal in Mac OSX looks plain. bash terminal, profile = Homebrew 1. Add Color To Bash To make the bash terminal console more colorful, you need to create or edit a ~/.bash_profile file, and configure the LSCOLORS value. See following example to show you how to create a new .bash_profile and …

Read more

How to access web server 8080 in Mac OS X

Mac OS x 10.8.3, running a Java’s web application on Tomcat, port 8080. Users from same network are able to access my web server via port 80, but failed on port 8080. Is there a firewall setting blocked the incoming connection via port 8080. Solution 1 The simplest solution is turn off your Firewall. Mac …

Read more

How to find large file size on Mac OS X

In this tutorial, we show you two ways to find large files on Mac OS X. Built-in search tools Find command 1. Search Tools To open the search tools, do following : Mac OS X Desktop, run Finder. Press Command+F to open “Search Tools” (it also can be located from menu -> File -> Find). …

Read more

sed command hits “undefined label” error on Mac OS X

See following scenario, create a file, add content, search and replace it. $ touch testing.txt $ echo "this is mkyong.com" > testing.txt $ cat testing.txt this is mkyong.com $ sed -i ‘s/mkyong/google/g’ testing.txt sed: 1: "testing.txt": undefined label ‘esting.txt’ This sed -i ‘s/mkyong/google/g’ testing.txt command is working properly in Linux, but hits “undefined label” error …

Read more

How to install gcc compiler on Mac OS X

Often times, you need c or gcc compiler to compile open source projects in Mac OS X. The problem is Mac OS X doesn’t install the gcc compiler by default. If you try to install or compile some projects that required c/gcc compiler, following errors message will be logged : configure: error: C compiler cannot …

Read more