Running on OS X
vasi opened this issue · comments
Run gdocs-export on OS X
Tested on macOS 10.12.2.
Install Homebrew
-
Use Homebrew installer. Will automatically fetch Apple's Dev Tools, if needed.
-
Install pandoc from Homebrew:
brew install pandoc
Install TeX
-
Install MacTeX from Homebrew:
brew cask install mactex
- This downloads several GB, takes a long time
- Open a new terminal window to continue
-
Install rubber:
brew install homebrew/tex/rubber
Setup Ruby
-
Install bundler:
gem install --user bundle
-
Put it in your path
echo 'export PATH="$PATH:$(ruby -e "puts Gem.user_dir")/bin"' >> ~/.profile
-
Open a new terminal window to continue
Setup Python
-
Install pip:
python <(curl https://bootstrap.pypa.io/get-pip.py) --user
-
Put it in your path:
echo 'export PATH="$PATH:$(python -m site --user-base)/bin"' >> ~/.profile
-
Open a new terminal window to continue
-
Install the pandocfilters module:
pip install --user pandocfilters
Google Docs access
- Visit the Google API Console
- Create a new project
- Search for "Drive", select "Google Drive API"
- Click "Create Project", name it gdocs-export
- Click "Enable"
- Create API keys
- Click "Create Credentials"
- Select "Other UI", "User data"
- Continue with reasonable values, until credentials are saved
- Click "Edit"
- Copy Client ID and Client Secret
Setup gdocs-export
-
Get the repo:
git clone https://github.com/dergachev/gdocs-export.git cd gdocs-export
-
Install dependencies:
bundle install --path vendor/bundle
-
Authenticate
-
Using the Client ID and Client Secret from above, run:
make api_auth CLIENT_ID=$myid CLIENT_SECRET=$mysecret
-
A URL will be printed to the console. Visit it in your browser, and click "Allow".
-
A file
google-api-authorization.yaml
will be created.
-
Try gdocs-export
-
Pick a Google Docs document. Eg: https://docs.google.com/document/d/1dwYaiiy4P0KA7PvNwAP2fsPAf6qMMNzwaq8W66mwyds/edit
-
Pick a name for your document, eg: test2 or my_test_document.
-
Download the document:
make api_download name=test2 doc='https://docs.google.com/document/d/1dwYaiiy4P0KA7PvNwAP2fsPAf6qMMNzwaq8W66mwyds/edit'
-
Export to a PDF:
make convert name=test2
-
The output will be placed in a path like:
build/test2/test2.pdf
Works great, thanks!