Editing an Xcode project via Terminal command - swift

I can open one of my Xcode project in Xcode and add Application supports iTunes file sharing=Yes to plist with Xcode and through Xcode directly, Now I was wandering if this work code be done completely via Terminal as well?
My Goal is type a command in Terminal that does the same work for plist just with Terminal and without opening Xcode program and doing it manually just with Terminal command. For example I have a random Xcode project saved on my Desktop, and since Xcode is accessible via Terminal, I want make this work.

As #Sweeper already answered you should got to the path of your .plist file and then write the following command:
vim Info.plist
This will open an editor which then you need to click on "i", then input the following line into the main tag:
<key>UIFileSharingEnabled</key><true/>
Then click "esc" then ":" then "w" then "q" and finally "Enter" and you are done.

Related

Set up Permanent Flutter Path for 2022 MacBook M1 Pro

I am trying to install Flutter on my M1 Pro. I am following along with this setup process -> https://docs.flutter.dev/get-started/install/macos#update-your-path
So far, I've downloaded Xcode & the Flutter SDK for Apple Silicon devices.
If I use the command, export PATH="$PATH:pwd/flutter/bin", which is a temporary path, it works. It's making the path permanent that I can't get to work. I didn't have a hidden file named .zshrc so I had to create one via the default EditText app. Currently, I have a .zshrc file with no extension in my home directory.
Per the Flutter instructions, I'm supposed to add this line in the .zshrc file -> export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin". It currently looks like -> export PATH="$PATH:/Users/MYUSERNAME/Development/flutter/bin".
I'm supposed to be able to close out of everything and then open a new terminal and type "flutter" and it work.. Instead I get, "zsh: command not found: flutter".
Can someone explain what I'm missing? According to an Academind tutorial, this should work.
I resolved this by deleting my .zshrc file and creating a .zshenv file. In the terminal I typed vim ~/.zshenv
Started a new terminal and flutter works!

Cannot install Flutter on MacOS blg sur terminal

I am not able to install flutter on my mac book.
There is no problem entering the SDK.
But after that is the problem. Run the terminal app and enter the path.
I watch lectures, watch YouTube, and follow them, but I can't.
i changed "bash -> zsh", and write 'vim ~/.zshrc'
and enter, but see a message like the one below.
what is the problem?....
enter image description here
enter image description here
VIM created a .swp file so you can't open two instances of the same file.
You may want to use nano command which is less complex to use than VIM to update your path in your .zshrc file

MacOS gives zsh: command not found: flutter after updating path according to Flutter Official Docs [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
Recently I updated Mac OS to latest Catalina and my terminal which is using zsh now start showing me following error:
zsh: command not found: flutter
It was working fine before update.
You need to update the environment path.
Open terminal.
vim $HOME/.zshrc
Press "I" key for going to insert mode.
add the following line in the opened file:
export PATH="$PATH:/YOUR_FLUTTER_DIR/flutter/bin"
Press "Esc" then write :wq! in terminal and press enter to exit vim.
Reopen the terminal and check "flutter doctor"
If this solution did not work, remove the double quote from path or use the full path explicitly instead of ~.
Working on macOS Catalina 10.15.5 (19F101).
I have used .zprofile instead of .zhrc
Provide Full Disk Access to Terminal by
Setting -> Security & Privacy -> Full Disk Access. Add Terminal
If the current terminal uses bash, change to zshell using the below command
chsh -s /bin/zsh
In the root directory i.e something like /Users/^YourAccount^ execute the below
touch .zprofile
vim .zprofile
Press I to enter insert mode. Type the below
export PATH=$PATH:/Users/^YourAccount^/^YourPath^/flutter/bin
Save and quit by pressing Esc, then :wq and Enter
Close Terminal and reopen Again. Then try executing flutter command
For me removing double quotes did the fix.
Try changing
export PATH="$PATH:[PATH TO FLUTTER]/flutter/bin"
into
export PATH=$PATH:[PATH TO FLUTTER]/flutter/bin
adding few more steps for easiness:
Open terminal.
vim $HOME/.zshrc
Press "I" to open insert mode.
add the following line in the opened file:
export PATH=$PATH:[PATH TO FLUTTER]/flutter/bin (remember I don't have double quotes here)
Press "Esc" then type :wq in terminal to exit edit mode.
Type
source .zshrc to reload the terminal for changes
You must update your environment $PATH variable.
1) Open the file $HOME/.zshrc $HOME is your home path
2) add the following line in the opened file:
export PATH="$PATH:/YOUR_FLUTTER_DIR/flutter/bin"
3) save the changes and restart your terminal session.
The process is also documented here
Follow these steps:
Open finder
Enter Cmd + Shift + G
Type ~ in Go to the folder popup.
Now enter Cmd + Shift + . to show hidden files.
Open .zshrc
Add this line
export PATH="$PATH:/YOUR_FLUTTER_DIR/flutter/bin"
Replace this /YOUR_FLUTTER_DIR with the path to your flutter directory.
In my mac, the path is
export PATH=$PATH:$HOME/FlutterDevelopment/flutter/bin
in android studio terminal, simply just type this command:
export PATH="/YOUR_FLUTTER_DIR/flutter/bin:$PATH"
change YOUR_FLUTTER_DIR to your actual directory
I updated from Mojave to Catalina and running Terminal, switched to the default/preferred zsh shell, from the bash shell.
Then was hit with
zsh: command not found: flutter
so, followed the advice seen elsewhere to only add the following to Users/MyUserId/.zshrc
export PATH="$PATH:/YOUR_FLUTTER_DIR/flutter/bin"
echo $PATH showed that /Users/MyUserId/flutter/bin was now one of the configured PATHs.
However, I couldn't get "flutter doctor" to work but came across a post on jelliesgame.com which suggested copying
Users/MyUserId/.bash_profile to Users/MyUserId/.zshenv
Now, flutter doctor gives a clean bill of health
This worked for me:
Steps:
Type on the terminal:
open .zshrc (This opens the document in text edit)
Add this to the end of the file:
export PATH="/Users/YOUR_USERNAME/Documents/code/tools/flutter/bin:$PATH"
Save and close .zshrc
Then type:
flutter doctor
Had the same issue and just realized that I forgot to add the close quote
So the correct way is to add to .zshrc by typing vim ~/.zshrc
PATH="$PATH:$HOME/Flutter/flutter/bin"
or
export PATH="$PATH:/YOUR_FLUTTER_DIR/flutter/bin"
then run source ~/.zshrc or just open a new terminal window
I tried installing flutter on my MAC according to the advice here, but it still doesn't work, after searching for it I found an article here.
So, I change my .zshrc file to:
export PATH="$PATH:/Users/YOUR_PROVILE_NAME/YOUR_DEVELOPMENT_FOLDER/flutter/bin"
Change YOUR_PROVILE_NAME to your name profile, also YOUR_DEVELOPMENT_FOLDER to your development folder for flutter
and now it's working.
Note:
I use Catalina OS v10.15.4
I followed URL to resolve my issue.
I simply created a .zshrc file which was not exist then added my PATH variables copied from existing .bashrc.
I had the same problem when upgrading to mac Catalina 10.15.4:
After many days of research, I have achieved success. Here are the steps I did:
First, open the terminal on your mac.
Next, use the command
cat .bash_profile
and copy the content.
Then type this command into the terminal:
nano $ HOME / .zshrc
and paste the content just copied above into. Save then type
source $ HOME / .zshrc
to refresh this file. Next type
echo $ PATH
to see if the content has been updated. If successful type
flutter --version
and you will see the result.
There are quite a few answers mentioned above pretty much same. I would say worth seeing into the SHELL using echo $SHELL command,
If you’re using Bash, edit $HOME/.bash_profile or $HOME/.bashrc. If you’re using Z shell, edit $HOME/.zshrc. If you’re using a different shell, the file path and filename will be different on your machine.
N.B. Don't forget you need to add VIM before either command in the terminal app.
For further details, click the link Update your path, and look into the section Update your Path. I hope it would help many especially new comers to MAC OS. Cheers
For me .zshrc worked instead of .zprofile. I believe this is because I had created .zshrc earlier and now when I tried creating .zprofile, it was looking into .zshrc file.
You can check if .zshrc file using ls -a command

Can't find Plist file in my Dev environment

I tried saving a Plist from my project and using NSLog printed out the path of the file.
I was using the iOS Simulator 4.2.
But I can't find it anywhere on my Mac.
/Users/Wayne/Library/Application Support/iPhone
Simulator/4.2/Applications/0C42C550-530A-4F2C-A422-6D948F2166A3/Documents/Message.plist
Any ideas where it could be?
The path your plist is being stored is
/Users/Wayne/Library/Application Support/iPhone Simulator/4.2/Applications/0C42C550-530A-4F2C-A422-6D948F2166A3/Documents/Message.plist
On OS X 10.7 Lion this path is hidden by default. There are several ways you can access this path.
1) Go to terminal and type
open "/Users/Wayne/Library/Application\ Support/iPhone\ Simulator/"
This will open the Finder at the iPhone simulator main directory.
2) In Finder click the "Go" menu and then hold the "option" (sometimes called "alt") key. The option to go to your User library will appear. Then you can navigate to the iPhone Simulator Directory.
3) If all of this seems a bit much and you would rather your ~/Library folder was visible all the time then you can go into terminal and unhide it using the following command
chflags nohidden ~/Library

Open multiple Eclipse workspaces on the Mac

How can I open multiple Eclipse workspaces at the same time on the Mac?
On other platforms, I can just launch extra Eclipse instances, but the Mac will not let me open the same application twice. Is there a better way than keeping two copies of Eclipse?
This seems to be the supported native method in OS X:
cd /Applications/eclipse/
open -n Eclipse.app
Be sure to specify the ".app" version (directory); in OS X Mountain Lion erroneously using the symbolic link such as open -n eclipse, might get one GateKeeper stopping access:
"eclipse" can't be opened because it is from an unidentified developer.
Your security preferences allow installation of only apps from the Mac App Store and identified developers.
Even removing the extended attribute com.apple.quarantine does not fix that. Instead, simply using the ".app" version will rely on your previous consent, or prompt you once:
"Eclipse" is an application downloaded from the Internet. Are you sure you want to open it?
By far the best solution is the OSX Eclipse Launcher presented in http://torkild.resheim.no/2012/08/opening-multiple-eclipse-instances-on.html It can be downloaded in the Marketplace http://marketplace.eclipse.org/content/osx-eclipse-launcher#.UGWfRRjCaHk
I use it everyday and like it very much! To demonstrate the simplicity of usage just take a look at the following image:
EDIT: Milhous's answer seems to be the officially supported way to do this as of 10.5. Earlier version of OS X and even 10.5 and up should still work using the following instructions though.
Open the command line (Terminal)
Navigate to your Eclipse installation folder, for instance:
cd /Applications/eclipse/
cd /Developer/Eclipse/Eclipse.app/Contents/MacOS/eclipse
cd /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
cd /Users/<usernamehere>/eclipse/jee-neon/Eclipse.app/Contents/MacOS
Launch Eclipse: ./eclipse &
This last command will launch eclipse and immediately background the process.
Rinse and repeat to open as many unique instances of Eclipse as you want.
Warning
You might have to change the Tomcat server ports in order to run your project in different/multiple Tomcat instances, see Tomcat Server Error - Port 8080 already in use
To make this you need to navigate to the Eclipse.app directory and use the following command:
open -n Eclipse.app
Actually a much better (GUI) solution is to copy the Eclipse.app to e.g. Eclipse2.app and you'll have two Eclipse icons in Dock as well as Eclipse2 in Spotlight. Repeat as necessary.
If the question is how to easily use Eclipse with multiple different workspaces, then you have to use a kludge because shortcuts in OS X do not provide a mechanism for passing command line arguments, for example the "--data" argument that Eclipse takes to specify the workspace. While there may be different reasons to create a duplicate copy of your Eclipse install, doing it for this purpose is, IMNSHO, lame (now you have to maintain multiple eclipse configurations, plugins, etc?).
In any case, here is a workaround. Create the following script in the (single) Eclipse directory (the directory that contains Eclipse.app), and give it a ".command" suffix (e.g. eclipse-workspace2.command) so that you can create an alias from it:
#!/bin/sh
# open, as suggested by Milhous
open -n $(dirname $0)/Eclipse.app --args -data /path/to/your/other/workspace
Now create an alias to that file on your desktop or wherever you want it.
You will probably have to repeat this process for each different workspace, but at least it will use the same Eclipse installation.
2018 Update since many answers are no longer valid
OS X Heigh Sierra (10.13) with Eclipse Oxygen
Go to wherever your Eclipse is installed. Right-click -> Show Package Contents -> Contents -> MacOS -> Double-click the executable called eclipse
A terminal window will open and a new instance of eclipse will start.
Note that if you close the terminal window, the new Eclipse instance will be closed also.
To make your life easier, you can drag the executable to your dock for easy access
Instead of copying Eclipse.app around, create an automator that runs the shell script above.
Run automator, create Application.
choose Utilities->Run shell script, and add in the above script (need full path to eclipse)
Then you can drag this to your Dock as a normal app.
Repeat for other workspaces.
You can even simply change the icon - https://discussions.apple.com/message/699288?messageID=699288&#699288
One another way is just to duplicate only the "Eclipse.app" file instead of making multiple copies of entire eclipse directory. Right-Click on the "Eclipse.app" file and click the duplicate option to create a duplicate.
If you're like me, you probably have terminal running most of the time as well.
You could just create an alias in /Users//.bash_profile like this
alias eclipse='open -n path_to_eclipse.app'
then all you have to do is just open the terminal and type eclipse.
Based on a previous answer that helped me, but different directory:
cd /Applications/Eclipse.app/Contents/MacOS
./eclipse &
Thanks
You can create an AppleScript file to open Eclipse with a given workspace. You can even save the AppleScript file as an Application, which is equivalent to creating an alias with arguments in Windows OS.
Open Script Editor and type the following:
do shell script "open '/path/to/your/Eclipse/installation' -n --args -data /path/to/your/workspace"
For instance:
do shell script "open '/Applications/Eclipse.app' -n --args -data /MyWorkspaces/Personal"
Press the Run button to check it's working.
This script can be saved as such, but I prefer to save it as an Application. That way I can customize the icon by copying the *.icns icon from the original Eclipse.app bundle to the script application bundle.
To open an App folder, use the "see contents" contextual menu option. It should look like this:
Where "main.scpt" is the AppleScript file and "applet.icns" is the icon from the original Eclipse bundle.
Launch terminal and run open -n /Applications/Eclipse.app for a new instance.
I found this solution a while back, can't remember where but it still seems to work well for me.
Create a copy of Eclipse.app for each workspace you want to work in (for this example ProjectB.app), then open ProjectB.app/Contents/MacOS/eclipse.ini and add these two lines at the beginning of the file:
-data
/Users/eric/Workspaces/projectb
... substituting where your workspace is located. When you launch ProjectB.app it will automatically start with that workspace instead of prompting for a location, and you should be able to run it at the same time as other Eclipse instances with no problem.
In Terminal simply paste below line and hit enter ..
/Applications/Eclipse.app/Contents/MacOS/eclipse ; exit;
If you want to open multiple workspaces and you are not a terminal guy, just locate the Unix executable file in your eclipse folder and click it.
The path to the said file is
Eclipse(folder) -> eclipse(right click) -> Show package
Contents -> Contents -> MacOs -> eclipse(unix executable file)
Clicking on this executable will open a separate instance of eclipse.
A more convenient way:
Create an executable script as mentioned above:
#!/bin/sh
cd /Applications/Adobe\ Flash\ Builder\ 4.6
open -n Adobe\ Flash\ Builder\ 4.6.app
In you current instance of Flashbuilder or Eclipse, add a new external tool configuration. This is the button next to the debug/run/profile buttons on your toolbar. In that dialog, click on "Program" and add a new one. Give it the name you want and in the "Location" field, put the path to the script from step 1:
/Users/username/bin/flashbuilder
You can stop at step 2, but I prefer adding a custom icon to the toolbar. I use a the Quick Launch plugin to do that:
http://sourceforge.net/projects/quicklaunch/files/
After adding the plugin, go to "Run"->"Organize Quick Lauches" and add the external tool config from step 2. Then you can configure the icon for it.
After you save that, you'll see the icon in your toolbar. Now you can just click it every time you want a new Flashbuilder/Eclipse instance.
You can run multiple instances of Eclipse by creating a pseudonym for Eclipse application in it's folder and using it for running new Eclipse instance
Lets try downloading this in your eclipse on Mac you will be able to open multiple eclipse at a time Link
Name : macOS Eclipse Launcher
Steps :
Go to eclipse Market place.
Search for "macOS Eclipse Launcher" and install.
It will restart .
Now under file menu check for open option > there you will find other projects to open also at same time .
Window -> New Window
This opens a new window and you can then open another project in it. You can use this as a workaround hopefully.
It actually allows you to work in same workspace.