Click On Tyler Support

Contact Us

Support Home » VirtualHostX » How Do I Edit Files Inside the Virtual Machine?

How Do I Edit Files Inside the Virtual Machine?

With the exception of your websites' files themselves, all of the other configuration files and settings related to VirtualHostX's web server are stored inside the virtual machine - not on your Mac.

If you need to edit one of those files - Apache's main .conf file as an example - you have a two options:

  1. You can login to the virtual machine using an SSH connection (i.e. through a Terminal window) and edit the file using a command line text editor such as nano (easy) or vim (advanced users).
  2. Or, you can use a traditional macOS GUI text editor with the help of another app such as Transmit or ExpanDrive.

In the following sections I will show how to edit the web server's main configuration file using the two methods above. The file we'll be editing is located inside the virtual machine (not on your Mac) here:


Editing a File Using the Command Line

First, launch VirtualHostX and then click the "Terminal" button in the app's toolbar to connect to the virtual machine.

VirtualHostX Terminal Button

In the Terminal window that appears, type the following command and press return:

nano /etc/apache2/apache2.conf

The nano text editor should open in your Terminal window and show the contents of that file. You can make any neccessary edits and then save your changes. Here is a tutorial for using nano. Nano Text Editor

Editing a File Using a macOS Text Editor

Using a 3rd party app like Transmit or ExpanDrive will let you browse the virtual machine's filesystem and edit files using your preferred macOS text editor. Here are instructions for connecting with Transmit:

Create a new connection and enter the following settings:

Protocol: SFTP
Port: 22
User Name: vagrant
Password: <leave blank>

Instead of using a password to connect, we need to use a "private key file".

  1. Open Transmit's Preferences window from the "Transmit" menu.
  2. Click on the "Keys" section icon.
  3. In the lower left corner of the window, click on the "+" button and choose "Import Keys...".
  4. An Open File dialog will appear. On your keyboard, press command+shift+G to open a "Go to the folder:" sheet and enter the following key file location... ~/Library/Application Support/com.clickontyler.VirtualHostX/VirtualHostX/.vagrant/machines/default/virtualbox/private_key
  5. Click the "Import" button.
  6. Close the window and go back to your connection settings. Click the "Key" icon and choose the new private key you just imported.

You can now click the "Connect" button to log in to the virtual machine and browse your files. I recommend saving your connection settings as a favorite within Transmit to remember your settings for the next time.


Your vote was sent, thanks!
Was this article helpful?


Contact Us