From 76a8c065e1786c2889a43f92bac05fc101e59692 Mon Sep 17 00:00:00 2001 From: Jared Rewerts Date: Tue, 2 Oct 2018 21:59:16 -0600 Subject: [PATCH] Create setup_mac_build_environment.md --- contrib/setup_mac_build_environment.md | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 contrib/setup_mac_build_environment.md diff --git a/contrib/setup_mac_build_environment.md b/contrib/setup_mac_build_environment.md new file mode 100644 index 00000000..02571767 --- /dev/null +++ b/contrib/setup_mac_build_environment.md @@ -0,0 +1,42 @@ +# How to setup Browsh's build system for Mac + +## Install Go +Follow the [install guide](https://golang.org/doc/install). Note that there is an installer for Mac. + +### Ensure your GOPATH is set +Open your terminal of choice. Run `echo $GOPATH`. +You should see something like `/usr/local/go`. Inside this folder, there will be a src folder. If there isn't one created yet, run `mkdir $GOPATH/src`. + +## Clone Browsh +Fork Browsh to your Github account. Clone this fork of Browsh to your $GOPATH/src folder you just created. + +## Install Firefox +Follow Firefox's [guide](https://support.mozilla.org/en-US/kb/how-download-and-install-firefox-mac) to installing Firefox on Mac. + +### Add the Firefox app to your PATH +Browsh needs to be able to create new instances of Firefox. Add the Firefox app to your path. It's probably something like `/Applications/Firefox.app/Contents/MacOS`. +To add this to your path, edit your path file by running `sudo nano /etc/paths`. Add the path to Firefox in here and save the file. + +## Install Node +[Install Node](https://nodejs.org/en/download/). The currently recommended version of Node for working with Browsh is v8.11.4. + +### Install NPM packages +Navigate to browsh/webext. Run `npm install`. + +### Install web-ext globally +Run `npm install -g web-ext`. This is Mozilla's handy tool for working with Firefox web extensions. + +## Run the build script +Navigate to the root of your Browsh project. This should be `$GOROOT/src/browsh`. Run `./interfacer/contrib/build_browsh.sh`. This will install several required packages. + +## Running Browsh from source +Now that you have all of the required dependencies installed, we can run Browsh. First, open 3 terminals. + +### Terminal 1 +This terminal will build the Javascript. From the `browsh/webext` folder, run `npx webpack --watch`. This will create a dist folder inside the webext folder. + +### Terminal 2 +This terminal will handle the Firefox web extension. From the `browsh/webext/dist` folder, run `web-ext run --verbose`. + +### Terminal 3 +This terminal will display Browsh. From the project root, run `go run ./interfacer/src/main.go --firefox.use-existing --debug`.