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.
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.
Related
I have a project that runs some utility I've installed using homebrew on one of its build rules.
On my M1 mac, homebrew is installed on /opt/homebrew/bin.
I have eval "$(/opt/homebrew/bin/brew shellenv)" present in my ~/.zprofile file, but it seems like Xcode doesn't respect that (or maybe overrides it?).
When trying to evaluate the PATH variable during Xcode run script command I get the following:
PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
For clearance, this is the phase I was running, under Build rules.
I've managed to find two workarounds that work with this issue, the first is to symlink the program you want from /opt/homebrew/bin onto /usr/local/bin (protoc in my case)
sudo ln -s /opt/homebrew/bin/protoc /usr/local/bin/protoc
The second is to add the following line to the build rule script:
eval "$(/opt/homebrew/bin/brew shellenv)"
This has the disadvantage of not working on non M1 Macs.
There is a possible, very simple solution provided by this answer.
Basically, freshly upgraded versions of XCode (for example, 13.4.1) running on Apple Silicon-powered Macs (like my M1 MacBook Pro), have components that cannot properly use/output the appropriate object files in all the output platform combinations you need.
This leads to some "interesting" issues and error message cross-overs that find "almost correct" answers on StackOverflow. Hence the many suggestions to exclude "arm64" platform and similar from the build options.
The simple answer to all of that is... to just run XCode with Rosetta enabled. Rosetta will engage with the components that miss the needed cross-platform capabilities.
Here is an example of how to enable an application to use Rosetta. You select the app icon, then go to the File menu and select "Get Info". Then click the "Open using Rosetta" checkbox.
I had a problem installing cocoapods flipper-glog so found out this solution to run:
this command xcode-select --switch /Applications/Xcode.app.
But what does this command actually do?
Many command-line tools require access to functionality that is actually hidden inside Xcode itself. xcode-select points to the copy of Xcode where that functionality is located.
If you say in the Terminal
cd /Applications/Xcode.app/Contents/Developer/usr/bin; ls
you will see some of the tools in question. For instance, if a cocoa pod needs to compile some code, it needs gcc which is located inside that directory within Xcode. Similarly make is in there (that's probably the main thing that flipper-glog needed).
So I am trying to use the Universal Linking Validator on Branch's website. I downloaded the script and opened the terminal and entered:
$ bash ulv_script.sh
Then I dragged and drop the project’s .xcodeproj file into the terminal window the result was:
ulv_script.sh: No such file or directory
How am I suppose to get the link I need?
Here are the directions I am following:
https://dev.branch.io/getting-started/universal-linking-validator/guide/
Jonas from Branch here.
The error you are seeing is because your terminal is in a different directory then the script. You can get around this by using the cd command to navigate to the location of the script.
Alternatively, you can enter bash into the terminal, drag and drop the downloaded script into the terminal window, and then drag and drop your .xcodeproj file into the window. Using this method, you should end up with a command that looks like bash /Users/jbauer/Downloads/ulv_script.sh /Users/jbauer/Desktop/BranchStuff/Branch-TestBed-Swift/TestBed-Swift.xcodeproj Note the space between the path to the script, and the path to the Xcode project.
Feel free to ping me if you run into any other issues, and I'd be happy to lend a hand.
I installed CMake (on ios), and it seemed like the installation was completed.
However, when I type
cmake -version
I get
-bash: cmake: command not found
Is there a need to set up CMake before using it?
Assuming you're talking about OS X, not iOS: CMake is installed, but not in the PATH in your shell. You can add it via something like:
PATH=$PATH:/Appications/CMake.app/Contents/bin
Then the cmake command will work on the command line.
You can edit the file ~/.bashrc to set your PATH this way every time you open the command line, instead of needing to do it manually each time.
https://en.wikipedia.org/wiki/PATH_(variable)
you can open CMake with GUI in Launchpad, and click the "tools" - > "How to Install For Command Line Use" menu, you'll find ways to solve it
The previous answer pointing to /Applications/CMake.app/Contents/bin is correct but you can go one step further.
If you run
/Applications/CMake.app/Contents/bin/cmake-gui --install
Then it will link the executables into /usr/local/bin.
I am trying to create a new porject with the latest version of cordova. I am following the instructions here but I get stuck at the Start New Project command line section
I follow the instruction where it says open the command line tool, drop the 'bin' file in and enter the following:
./create ~/Documents/CordovaXY/HelloWorld org.apache.cordova.HelloWorld HelloWorld
But when I hit enter all the command line says is
No such file or directory
Is there anyway to do this without using command line?
Thanks!
Using the command line is probably the easiest way to do it, so keep trying!
I would run just the command
./create
without parameters. If you get a warning message and a list of possible flags and parameters then this means that your problem is in the parameters
~/Documents/CordovaXY/HelloWorld org.apache.cordova.HelloWorld HelloWorld
and not the command itself.
My guess is that you have to create the CordovaXY directory.
Otherwise, double check that the 'Xcode Command Line Tools' are correctly installed. The page you linked states "Cordova uses the command line to create a new application project. To access the Xcode tools from the command line an additional download is required."
OK it was my stupid fault for not reading the instructions properly. I dragged the bin directory into the already open terminal window, instead of onto the Terminal Icon in the Dock