Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

How to Install on a fresh Mac

cam156 edited this page Jan 16, 2019 · 34 revisions

Many of these steps were taken from here and or reference this document: http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#step-4

These steps were originally for OS X Mountain Lion but have been updated for OS X Mavericks.

  1. Follow step 1 (http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#step-1) to install xcode
  2. Follow step 2 (http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#step-2) to verify gcc
  3. su to an admin user
  4. Run the ruby -e step from (http://brew.sh/)
  5. exit out of the su
  6. run brew doctor
  7. you might need to make sure you own the /usr/local/ folder so that you don't need to sudo when using brew or bundler. To do this, run the following: sudo chown -R your_user_name:staff /usr/local/
  8. and you also might need to chown -R your_user_name:staff /Library/Caches/Homebrew/
  9. Install Git by following step 3 ( https://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#step-3)
  10. Configure Git by follow step 4 ( http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#step-4)
  11. Run Steps to install RBenv (https://github.com/sstephenson/rbenv#homebrew-on-mac-os-x)
  12. set up your git ssh key by following the steps here: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
  13. run git clone [email protected]:psu-stewardship/scholarsphere.git
  14. run brew install clamav
  15. The current version of clamav 0.98.4 has some issues that cause Ruby to throw a "Can't allocate memory" error. To work around this switch to the previous version:
brew versions clamav
# if version is 0.98.4 follow these steps to downgrade to 0.98.3
cd /usr/local
git checkout XXX YYY (where XXX and YYY are the values for 0.98.3 reported above)
brew unlink clamav
brew install clamav
brew switch clamav 0.98.3
  1. create configuration files for freshclam
cp /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf
cp /usr/local/etc/clamav/clamd.conf.sample /usr/local/etc/clamav/clamd.conf
perl -pi -e 's/^/#/ if /^Example/' /usr/local/etc/clamav/freshclam.conf
  1. run freshclam

  2. run brew install mysql

  3. run mkdir -p ~/Library/LaunchAgents

  4. run ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

  5. run mysql -uroot

  6. run CREATE USER 'user'@'localhost' IDENTIFIED BY 'pass';

  7. run GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';

  8. run FLUSH PRIVILEGES;

  9. run quit

  10. run brew install redis

  11. run ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

  12. run launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

  13. run brew cask install xquartz

  14. run brew install imagemagick --with-ghostscript --with-x11 --with-tiff --with-jp2

  15. You may run into issues with mogrify and text extraction not running rspec ./spec/features/file_set/extracted_text_search_spec.rb:16

    1. I needed to revert my version of ghostscript
      brew unlink ghostscript
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/946485c40d03f19a53b711214b51fe614648fcd4/Formula/ghostscript.rb
      
  16. run brew install ffmpeg --with-tools --with-fdk-aac --with-libvorbis --with-libvpx

  17. run brew install fits

  18. mark fits.sh as executable chmod u+x /usr/local/Cellar/fits/1.2.1/bin/fits.sh

  19. run fits.sh -h from the command line and see a help message to ensure FITS is properly installed

  20. add the full fits.sh path to your PATH (e.g., in your .bash_profile) export PATH="$PATH:/usr/local/Cellar/fits/1.2.1/bin/fits.sh"

  21. run brew cask install libreoffice LibreOffice is only needed if you want to generate thumbnails for Microsoft Office documents (.docx, .pptx, et cetera.)

  22. add the path to "soffice" to your PATH (typically under /Applications/LibreOffice.app/Contents/MacOS/)

  23. run cd scholarsphere say yes to trusting the .rvmrc file

  24. install bundler gem install bundler (On a brand new Mac you might need to exit Terminal and open it again to force the rbenv shims to be regenerated and recognize bundle install on the next step)

  25. run bundle install

    1. you may have a clamav issue fix is here: https://github.com/psu-stewardship/scholarsphere/wiki/Clam-AV-Error-on-Bundle-install
    2. you may have a mysql issue run export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
  26. To copy the config files to the local location run (Alternatively you can ask one of the developers on the team for their current config files):

cp config/sample/* config/
cp config/sample/initializers/* config/initializers/
  1. edit config/database.yml and comment out the top sqlite half and uncomment the bottom MySQL half. Update the socket setting to be /tmp/mysql.sock. To find the socket location on your MySQL instance run mysqladmin variables | grep socket
  2. edit config/hydra-ldap.yml to point to the correct ldap location
  3. for deployment you need a newrelic.yml file
  4. run rake db:create (note if things start acting funny here reboot and double check privileges are still applied in mysql)
  5. run rake scholarsphere:generate_secret
  6. run rake db:migrate
  7. run RAILS_ENV=test rake db:migrate
  8. run solr_wrapper --config config/solr_wrapper_test.yml
  9. run fcrepo_wrapper --config config/fcrepo_wrapper_test.yml
  10. run bundle exec rails server

Running the Application Locally

When running the app locally in development, you need to spoof the LDAP integration. Use the modHeaders plugin for Chrome, or the Modify Header plugin for Firefox. This is only when running in development mode when you need to look at the application in a complete web environment.

Configure the plugin (either for Chrome or Firefox) by setting the REMOTE_USER variable. Ex:

REMOTE_USER = "xyz123"

Use your Penn State ID for the user. If you have authenticated to PSU services, such as Webmail, then reloading the Scholarsphere homepage will use that authentication token and you will appear as logged in using the same user with which you authenticated earlier.

In addition, you might consider creating a bash script with the following commands so that Jetty and resque-pool can be easily be restarted next time you reboot your machine:

cd ~/dev/scholarsphere
rake jetty:start
resque-pool --daemon --environment development start
Clone this wiki locally