macOS Configuration Guide

EE4717 / IM4717 WEB APPLICATION DESIGN

Prerequisite

  1. You should have VirtualBox installed and opened.
  1. You should have just imported the .ova virtual machine file provided by the school.

Setup Steps

#1 - Create a new Host-only Network Adapter

  1. Click on FileHost Network Manager... from the menu bar.
  1. Click on the Create button.
  1. Click on the Properties button.
  1. Change the IPv4 Address to 192.168.56.2 as shown below.
  1. Click on the IPv4 Network Mask field. (To make sure that the IPv4 value is not reverted)
  1. Click on Apply to confirm.
  1. Click on Close.

#2 - Add SMB Port Forwarding

  1. Click on the virtual machine that you have just imported.
  1. Click on the Settings button.
  1. Click on the Network button.
  1. Under Adapter 1, click on the text Advanced.
  1. Click on the Port Forwarding button.
  1. Click on the Green Plus Icon button.
  1. Fill in the Name: smb, Protocol: TCP, Host Port and Guest Port: 445 as shown below.
  1. Click on the OK button twice to save and close Settings.
  1. Start your virtual machine.
  1. Your web server should be live at http://192.168.56.2 and http://192.168.56.2:20000.
  1. If you are unable to load the page at http://192.168.56.2, please change the Host Port of web from 80 to 8080 and smb from 445 to 4450. Your web server url is now http://192.168.56.2:8080.

#3 - Set up the executable for the folder mapping

  1. Create a new text file named map_osx.txt using your favourite text or code editor.
  1. Paste in the following code.
    #TODO: Update the 'x' in user based on the second number of tutorial group.
    #Example, if your tutorial group is F311, then your user should be f31ee.
    user="f3xee"
    
    #DO NOT CHANGE ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING
    folder="$user-shortcut"
    cwd="`dirname \"$0\"`" 
    if [ -d "$cwd/$folder" ]
    then
    	umount  $cwd/$folder
    	rm -r $cwd/$folder
    else
    	mkdir $cwd/$folder
    	mount_smbfs //$user:$user@192.168.56.2/$user $cwd/$folder
    fi
    osascript -e 'tell application "Terminal" to quit' &
    exit
  1. Update the x in user value according to the second number of your tutorial group.
  1. If you have changed the smb port to 4450, add :4450 after @192.168.56.2.
  1. Ensure that there is no extra text before or after the code block as shown above.
  1. Save the file as map_osx.txt.
  1. Close the editor.
  1. Rename the file in Finder, removing the .txt from the file name and confirm the prompt to remove the extension.
  1. Open Terminal. You may open through Spotlight Search (Press ⌘ command + spacebar).
  1. Type in chmod +x , with an extra trailing space after the +x.
  1. Drag the map_osx file that you have created into the Terminal window.
    For the map_osx file that is dragged in, ensure that the name does not end with .txt. If you see that your current command ends with .txt, please follow the below points. a. Clear your current terminal screen by pressing ^ control + c. b. Type mv , with an extra trailing space. c. Drag the file into the terminal twice. d. Press the delete key until the .txt is removed. e. Press the return key on your keyboard (Also known as the Enter key). f. Restart with Step 9 above.
  1. Press the return key on your keyboard (Also known as the Enter key).
  1. This file that you have just created is now an executable file.

Usage Instructions

Bonus Tips

Bypass Expired Certificate

Latest version of Google Chrome and Safari will disable access to pages with expired certificates.

If you are unable to access https://192.168.56.2:20000, please download Mozilla Firefox.


Update on August 12, 2021 by Yumeng:

You may want to try the option 2 in this link Chrome: Bypass “Your connection is not private” Message.

Strange steps, but it works for me ꉂ ೭(˵¯̴͒ꇴ¯̴͒˵)౨


Scale Virtual Machine Window

Due to the high resolution displays on Macs, the virtual machine window might be very small.

With the virtual machine in focus, click on the ViewVirtual Screen 1Scale to 200% to scale it up.

Proper Shutdown of Virtual Machine

When you press the close button of the virtual machine, you can pick among the following options as shown in the image on the right. Select the Send the shutdown signal option in order to shut it down properly.

🐤
Written by Ian Ng @licitdev on August 12, 2020 (Last updated on October 26, 2020)