Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS iOS Tools CocoaPods CocoaPods

Cocoapods installed, but not working

I have been on the iOS Track and have run into a problem when trying to use Cocoapods for the Photo Bomber App.

I was able to successfully install Cocoapods:

Successfully installed cocoapods-0.32.1
Parsing documentation for cocoapods-0.32.1
1 gem installed

but when I try to run 'pod' it does not work:

pod
[!] No `Podfile' found in the current working directory.

I have tried to reinstall cocoapods, but got an error when trying to uninstall

$ gem uninstall cocoapods
Remove executables:
    pod, sandbox-pod

in addition to the gem? [Yn]  n
Executables and scripts will remain installed.
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

I really would like to get this figured out so I can move forward in the iOS Track. Any suggestions?

8 Answers

Roberto Alicata
PLUS
Roberto Alicata
Courses Plus Student 39,959 Points

in the Podfile write this:

pod 'SAMGradientView'

then open your Terminal and go to the directory of the project, something like this:

$ cd /User/roberto/Works/Example

then launch your pod command in the terminal

$ pod
Roberto Alicata
PLUS
Roberto Alicata
Courses Plus Student 39,959 Points

Are you sure you have a Podfile in the directory you are using?

I'm not sure. How do I check?

Roberto Alicata
PLUS
Roberto Alicata
Courses Plus Student 39,959 Points

reinstall the cocopods

then open Xcode

Create a new project (in the video it is a Single View Application named "Example")

then right click on the project name in the treeview on the left and choose "New File"

Choose "Other" then "Empty" and rename it "Podfile"

Roberto Alicata
PLUS
Roberto Alicata
Courses Plus Student 39,959 Points

Are you typing the "pod" command in the directory of the project?

I tried that and it is still not working. Now the pod command is returning:

$ pod
Usage:

    $ pod

      CocoaPods, the Objective-C library package manager.

Commands:

    + help                Show help for the given command.
    + init                Generate a Podfile for the current directory.
    + install             Install project dependencies
    + ipc                 Inter-process communication
    + lib                 Develop pods
    + list                List pods
    + outdated            Show outdated project dependencies
    + plugins             Show available CocoaPods plugins
    + push                Temporary alias for the `pod repo push` command
    + repo                Manage spec-repositories
    + search              Searches for pods
    + setup               Setup the CocoaPods environment
    + spec                Manage pod specs
    + trunk               Interact with the CocoaPods API (e.g. publishing new
                          specs)
    + try                 Try a Pod!
    + update              Update outdated project dependencies

Options:

    --silent              Show nothing
    --completion-script   Print the auto-completion script
    --version             Show the version of the tool
    --verbose             Show more debugging information
    --no-ansi             Show output without ANSI codes
    --help                Show help banner of specified command

and the pod update command still errors and says:

$ pod update [!] No `Podfile' found in the current working directory.

Do you mean like my "pod 'SimpleAuth/Instagram'" in my Podfile?

I tried this and '$ pod' was still not working....but '$ pod install' worked! Thank you for all of your help!

I have the exact issue and '$ pod install' does not work for me. Does anyone have any other ideas?

EDIT

After some digging, I found this: https://github.com/CocoaPods/CocoaPods/issues/2185 which indicates that this is a known bug that will be fixed in the next release of cocoa pods (unless I'm reading this wrong). When I installed a previous version of cocoa pods, what Sam did in the video worked fine.