|
| 1 | +# How to setup Browsh's build system for Mac |
| 2 | + |
| 3 | +## Install Go |
| 4 | +Follow the [install guide](https://golang.org/doc/install). Note that there is an installer for Mac. |
| 5 | + |
| 6 | +### Ensure your GOPATH is set |
| 7 | +Open your terminal of choice. Run `echo $GOPATH`. |
| 8 | +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`. |
| 9 | + |
| 10 | +## Clone Browsh |
| 11 | +Fork Browsh to your Github account. Clone this fork of Browsh to your $GOPATH/src folder you just created. |
| 12 | + |
| 13 | +## Install Firefox |
| 14 | +Follow Firefox's [guide](https://support.mozilla.org/en-US/kb/how-download-and-install-firefox-mac) to installing Firefox on Mac. |
| 15 | + |
| 16 | +### Add the Firefox app to your PATH |
| 17 | +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`. |
| 18 | +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. |
| 19 | + |
| 20 | +## Install Node |
| 21 | +[Install Node](https://nodejs.org/en/download/). The currently recommended version of Node for working with Browsh is v8.11.4. |
| 22 | + |
| 23 | +### Install NPM packages |
| 24 | +Navigate to browsh/webext. Run `npm install`. |
| 25 | + |
| 26 | +### Install web-ext globally |
| 27 | +Run `npm install -g web-ext`. This is Mozilla's handy tool for working with Firefox web extensions. |
| 28 | + |
| 29 | +## Run the build script |
| 30 | +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. |
| 31 | + |
| 32 | +## Running Browsh from source |
| 33 | +Now that you have all of the required dependencies installed, we can run Browsh. First, open 3 terminals. |
| 34 | + |
| 35 | +### Terminal 1 |
| 36 | +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. |
| 37 | + |
| 38 | +### Terminal 2 |
| 39 | +This terminal will handle the Firefox web extension. From the `browsh/webext/dist` folder, run `web-ext run --verbose`. |
| 40 | + |
| 41 | +### Terminal 3 |
| 42 | +This terminal will display Browsh. From the project root, run `go run ./interfacer/src/main.go --firefox.use-existing --debug`. |
0 commit comments