Update script to be more defensive

- Create lib directory with app-specific scripts
- Update bin/osx script to be more defensive