Category Archives: OSX

Simple way to add system variable to OSx

one simple way to add system variables to OSx is to include them in .zshrc file from your home ~

vim ~/.zshrc 

and in there the new variable and also include it into $PATH

eg: with JAVA_HOME

export JAVA_HOME="/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home"

export PATH="$JAVA_HOME:$PATH"

How to edit the hosts file on Mac OS X

The hosts file in a computer represents a simple plain text file, where are mapped hostnames to IP addresses (wiki).

To edit this file on Mac OS X is a very simple task:

  • Open the Terminal.app 
    (using Spotlight : command + space  – and then write terminal)
  • Edit the file /private/etc/hosts
    (you can use vim or nano …. ex: sudo nano /private/etc/hosts)
  •  Add the new map:
    add at the end the new map you want : ex: 127.0.0.1         new.address.com
  • Save the hosts file
    save the file with the new map

If you want that your change to take place immediately, run the following command:

  • dscacheutil -flushcache

Now you can test the new mapping.