Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods terminal setup 'edit' command not found?

I am attempting to setup an installation using Cocoapods for my iOS Xcode project.

cocoapods.org

When I get to the point where I need to edit my Podfile, it doesn't work. I attempt to execute the command edit Podfile in the correct directory, but I get:

-bash: edit: command not found

I'm not exactly sure what to do and performing that line is pretty vital to getting cocoapods working correctly.

I have tried restarting terminal and my computer as well with no luck.

like image 893
BlueBear Avatar asked Mar 20 '23 19:03

BlueBear


1 Answers

Bit of a strange one from the Cocoapods documentation there, as there is no edit command built into OS X as far as I'm aware. They probably just intend that example to mean 'edit with your favourite text editor', or it could be that they're using TextWrangler's commandline tool (see below). Here are some alternatives you could try, however...

Open the Podfile with TextEdit

open -a TextEdit Podfile

This will open up your Podfile with TextEdit. Replace 'TextEdit' with the name of some other app if you prefer.

Set up SublimeText or TextWrangler to work from the command line

Both of the popular text editors SublimeText and TextWrangler have the option of installing command-line executables.

TextWrangler asks you on first launch whether you want to install them, and will then do it automatically. For Sublime Text you need to run the following command:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

(You may need to change the path to the application in there depending on whether you have ST 2 or 3 installed)

Depending on which editor you use, you'll have two possible commands you can use:

  • subl Podfile - open your Podfile with SublimeText
  • edit Podfile - open your Podfile with TextWrangler

Use a Terminal editor

Finally, for the more advanced user, you could use a terminal-based editor, such as Vim or Nano. Nano is easier to get started with, and is fine for small edits like this. Just run nano Podfile from the Terminal.

like image 146
James Frost Avatar answered Mar 23 '23 13:03

James Frost