Swift 3 only runs from root and once

Programming languages, Coding, executables, and scripting.
Post Reply
Message
Author
ardawan
Posts: 10
Joined: 2017-06-08 05:36

Swift 3 only runs from root and once

#1 Post by ardawan »

Hi,
I've installed Swift 3 language but i can only run it as root and i should type export path command first. It's not permanent.

Code: Select all

root# export PATH="/opt/swift/swift-3.1.1-RELEASE-ubuntu16.10/usr/bin:$PATH"
root# swift
Welcome to Swift version 3.1.1 (swift-3.1.1-RELEASE). Type :help for assistance.
  1> 
if i exit from root and enter again i cant run swift only by typing swift in the terminal

Code: Select all

root# swift
bash: swift: command not found
This is same when im trying to run it from user account(Not root)

How can i fix it and run it like python from anywhere (root or user account)?

Thanks in advance

arochester
Global Moderator
Global Moderator
Posts: 2058
Joined: 2010-12-07 19:55
Has thanked: 1 time
Been thanked: 3 times

Re: Swift 3 only runs from root and once

#2 Post by arochester »

Are you supposed to run Swift, or do you write a Swift program and run that? https://developerslogblog.wordpress.com ... an-jessie/

ardawan
Posts: 10
Joined: 2017-06-08 05:36

Re: Swift 3 only runs from root and once

#3 Post by ardawan »

arochester wrote:Are you supposed to run Swift, or do you write a Swift program and run that? https://developerslogblog.wordpress.com ... an-jessie/
I follow this tutorial to install it. but my problem is before type "swift" to tun swift interpreter in terminal i must type this long command everytime

Code: Select all

export PATH="/opt/swift/swift-2.2-RELEASE-ubuntu14.04/usr/bin:$PATH"
Otherwise i get this

Code: Select all

bash: swift: command not found
Is there any way to make it permanent?

arochester
Global Moderator
Global Moderator
Posts: 2058
Joined: 2010-12-07 19:55
Has thanked: 1 time
Been thanked: 3 times

Re: Swift 3 only runs from root and once

#4 Post by arochester »

Change as appropriate
At this point, you have Swift installed. Next step is to add it to your system PATH:

Code: Select all

1 export PATH=/usr/local/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:$PATH
If you want to permanently add Swift to your PATH, use:

Code: Select all

1 echo 'export PATH=/usr/local/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:$PATH' >> .profile
2 source .profile
- https://www.solarianprogrammer.com/2016 ... t-3-linux/

ardawan
Posts: 10
Joined: 2017-06-08 05:36

Re: Swift 3 only runs from root and once

#5 Post by ardawan »

arochester wrote:Change as appropriate
At this point, you have Swift installed. Next step is to add it to your system PATH:

Code: Select all

1 export PATH=/usr/local/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:$PATH
If you want to permanently add Swift to your PATH, use:

Code: Select all

1 echo 'export PATH=/usr/local/swift-3.0.1-RELEASE-ubuntu16.04/usr/bin:$PATH' >> .profile
2 source .profile
- https://www.solarianprogrammer.com/2016 ... t-3-linux/
Before reading your answer I found the way to paste in the profile file.
But I've visited the link and it's good stuff there.
Thanks for sharing

Post Reply