Forge ModLoader Setup (Mac OS X) - TriValleyCoderDojo/Minecraft-Jar-Hacks GitHub Wiki

Follow these instructions to setup a development environment on your Mac for creating Minecraft mods. These instructions were written for a Mac running OS X 10.9 (Mavericks), but should work for any recent version of OS X.

1. Installing Java

You need Java on your Mac to play Minecraft and to use Eclipse to hack Minecraft. By default, Apple no longer includes Java in OS X, so it must be installed separately. Apple provides a Java 6 download for OS X, which is the one required by Eclipse. The Java 6 install includes both the run-time environment (JRE) and development kit (JDK).

Note: While Java 7 is the most recent version available from the Java.com website, it does not work with Eclipse. You must use Java 6 from Apple.

To determine if you have Java installed, and what version, open a Terminal window and type the command

java -version

What you see after typing this command depends on what you have installed on your Mac:

  • If Java 6 is installed, you will see something similar to the following:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

The "1.6" in the version indicates you have Java version 6 installed and are good to go. Proceed to the next step.

  • If Java is not installed, you will get a prompt inviting you to install Java 6:

Click Install and follow the install instructions.

  • If Java 7 is installed, you will see something similar to the following:
java version "1.7.0_06-ea"
Java(TM) SE Runtime Environment (build 1.7.0_06-ea-b13)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b04, mixed mode)

The "1.7" in the version indicates you have Java version 7. In order to use Eclipse, download and install the official Java 6 for OS X package from Apple: Java for OS X 2013-005.

2. Create a directory structure for your development environment

In this step, you will create a place to store the files used for your development projects. To make things easier for the mentors and yourself, let's use a standard location for the installation. That way if there are questions or problems, then the mentors will know where to look for things. In addition, later instructions will assume the use of the standard directory.

From Finder, navigate to your User directory (/Macintosh HD/Users/[user]) and create the following folders:

  • dev
  • dev/tools
  • dev/source
  • dev/source/minecraft
  • dev/source/minecraft/mods

This creates directories under your user directory to store all of your development tools and source files, and should look like this:

Folder Structure

To make things more convenient, you may also want to add the "dev" directory as a Favorite by dragging the dev folder to the Favorites list in Finder.

3. Installing Eclipse

Eclipse is a very popular Integrated Development Environment (IDE). It is free and there are many tutorials available, such as Lars Vogel's Eclipse Tutorial. There are other IDEs available (NetBeans, IntelliJ, etc…), but Forge was built around Eclipse. It will be just easier to use Eclipse, and it will be assumed that Eclipse is being used.

  1. Download Eclipse from here. Select the package "Eclipse IDE for Java EE Developers". You can download 32 bit or 64 bit depending on your computer.

How do I know if my computer is 32 bit or 64 bit? Most modern Macs (later than 2007) are 64-bit. If you are running OS X 10.7 or later, then your computer is 64 bit. You can find additional information on this topic here.

Choose a mirror site close to you to download from. For example, Oregon State University Open Source Lab.

Note: Not all the Eclipse mirror sites are created equal. Sometimes you may start a download with one mirror that is moving very slowly, for instance over 1 hour to finish. In these cases, the best thing to do is to cancel that download and try a different mirror site, which can be found by scrolling down the page.

  1. Open the .tar.gz file to unzip it. This creates a folder titled "eclipse" in your download directory.

  2. Move the "ecliplse" folder from your download directory to the "~/dev/tools" directory you previously created.

4. Installing Forge

  1. Next, you will download the Forge Suite from http://www.minecraftforge.net. When you first land on the page, click on the Releases link, which will take you to a page with a listing of all the current releases. The latest release is 1.7.2, but there is no shell script to automate the install. So instead, we are going to install the 1.6.4 release. Click on the link for the 1.6.4 release:

Forge Release List

After clicking on the release, you will be taken to the details of that release. There will be a number of choices listed. Find the "Source" download and click on the Adfly link:

Forge Release Details

After clicking the Adfly link, you will need to wait five seconds for the "SKIP AD" button to appear in the upper right hand corner of the web page. Click on the "SKIP AD" button to begin the download.

Skip Ad

  1. Once Forge has finished downloading, move the file (e.g.: forge-1.6.4-9.11.1.953-src.zip) to the ~/dev/source/minecraft/mods directory and extract it there by double-clicking on it.

  2. Next, you will need to complete the installation of your Forge development environment. Forge comes with a bunch of automated scripts that will do a lot of configuring, downloading, decompiling and so forth. It really does a lot, and fortunately for us, we really don't need to understand any of it. We just need to let the Forge install do what it does. There is a shell script that you will need to run, install.sh.

  • Open a new Terminal window
  • In the Terminal window change to the Forge directory, change the permissions for the install script to allow it to run, and run the install script by entering the following commands:
cd ~/dev/source/minecraft/mods/forge
chmod 755 install.sh 
./install.sh

The install script will do a whole lot of stuff and take a really long time, something like 10 minutes. Also, it may generate some errors when compiling some of the Minecraft files, but most likely that will be okay. Generally, you can ignore them and continue on. However, sometimes there are valid problems. The best thing to do is give it a try and see what happens.

Forge Install Script

5. Make a Backup

Once the install script has completed, the first thing you should do is to make a backup copy of the entire forge directory. The reason is that this will give you a clean copy of a fully configured instance of Forge. If for some reason something goes wrong and something gets corrupted (gee that would never happen right!), you would always be able to go back to your backup copy and start over. Otherwise, you would need to re-run the install and have to wait all over again. In addition, you would need to make different copies of Forge if you decide to go to the next level and start creating your own custom mods that you can distribute. You can make a backup by simply copying the entire directory.

6. Run Eclipse

At this point, you are ready to launch your MCP instance in Eclipse. You will need to start Eclipse and then point the workspace to the one created for you when Forge was installed.

  1. To start Eclipse, navigate to the ~/dev/tools/eclipse directory, and double-click on the Eclipse app.

Note: Because the Eclipse app is from an unidentified developer, you may receive a message saying the app cannot be opened due to security settings. If this happens, right-click (two-finger click) on the Eclipse app, and select Open. You will be prompted to confirm that you really want to open the app. Click on Open.

Gatekeeper Open App Confirmation

  1. Eclipse will prompt you to you to select a workspace. Since we used a standard directory, we know exactly where that will be. Click on Browse... and navigate to /Users/[username]/dev/source/minecraft/mods/forge/mcp/eclipse and click OK.

Starting Eclipse

  1. Eclipse will come up and it may take a little while for the project to synchronize and finish building. After Eclipse has settled down, you should see a single project in the workspace, named Minecraft. From here you will be able launch Minecraft from inside of Eclipse. It is a good idea to make sure this basic step works before doing any hacking. To do this just click on the Run button in the menu bar, as shown below:

Running Forge

Okay, so at this point, you will get an instance of Minecraft that is running inside of Eclipse. You should be able to go in and create a new world and navigate around in the world, while doing everything you would normally do in a Minecraft world.

However, these are not exactly a normal worlds. Everything you do here will be in Eclipse. These worlds should only be used to test the changes you make. These are separate from the worlds you create with the normal client, so you don't need to worry about making any changes to them. Another thing to be aware of is that you will be logged in as random user every time you enter one of your testing worlds.

Congratulations!

Congratulations! You have setup your Forge development environment!

Good Luck & Happy Hacking!