Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cmd_Z_4ever

macrumors newbie
Original poster
Jul 22, 2025
27
6
Hello everyone, I'm getting the "build failed" error when trying to run python in Xcode, and the console is not showing the output. Please help me, thank you.
Screenshot 2025-11-18 at 8.58.22 PM.png
 
Had you installed the necessary dependencies for python 🐍 code, and are you using a version compatible with Xcode?

Which Xcode version are you running on your mac?
 
How's your xcodeproj set up?

There's no Xcode template for Python projects.

You can set it up for it, but it requires a bit of work. And it's non trivial if you want to keep your project in a protected location like Downloads, Documents or Desktop.

But if you have your project in your home folder, it works to set the executable in the Scheme editor to /usr/bin/python3, and set its argument to $(SRCROOT)/subdirs/main.py
Also make sure to remove all build phases.

You can also set the copy files build phase to copy your py scripts into the products folder to give some meaning to the build phase or set up whatever you want to rebuild cached JIT py script with whatever tooling you have; But Xcode is geared towards building native binaries.

If you want Xcode to tell you more about the build failure open the error inspector (cmd+5, click the warning icon in the navigation pane or click the red X in the status area)
 
  • Like
Reactions: goldmac2006
If you want to enjoy Python programming, download JetBrains PyCharm Community edition. Can't go wrong with a dedicated Python IDE.
I'm using Xcode 16, and latest version of python.
OP, you should try using a dedicated IDE for Python.

I use Xcode for non-iOS app development like C++ on command line tool, but if I were to develop Java or Python, I would use Visual Studio Code. That’s how I used it for my Java bootcamp class I took over winter break last year.
 
  • Like
Reactions: Cmd_Z_4ever
How's your xcodeproj set up?

There's no Xcode template for Python projects.

You can set it up for it, but it requires a bit of work. And it's non trivial if you want to keep your project in a protected location like Downloads, Documents or Desktop.

But if you have your project in your home folder, it works to set the executable in the Scheme editor to /usr/bin/python3, and set its argument to $(SRCROOT)/subdirs/main.py
Also make sure to remove all build phases.

You can also set the copy files build phase to copy your py scripts into the products folder to give some meaning to the build phase or set up whatever you want to rebuild cached JIT py script with whatever tooling you have; But Xcode is geared towards building native binaries.

If you want Xcode to tell you more about the build failure open the error inspector (cmd+5, click the warning icon in the navigation pane or click the red X in the status area)
Hey thank you for your reply. I don't know much about these stuff, but I have a little bit of experience with html, css, and javascript. I'm just exploring things. Actually I followed this guide but I don't know where I'm going wrong. I think I need to use a dedicated IDE for python as all are saying.
 
OP, you should try using a dedicated IDE for Python.

I use Xcode for non-iOS app development like C++ on command line tool, but if I were to develop Java or Python, I would use Visual Studio Code. That’s how I used it for my Java bootcamp class I took over winter break last year.
Thank you for your suggestion buddy.
 
  • Like
Reactions: goldmac2006
Hey thank you for your reply. I don't know much about these stuff, but I have a little bit of experience with html, css, and javascript. I'm just exploring things. Actually I followed this guide but I don't know where I'm going wrong. I think I need to use a dedicated IDE for python as all are saying.
It'd be easier but you don't *need* to. I've set up an Xcode project for Python before answering your initial post and it works just fine, minus some quirks. I basically did the same as the guide but slightly different in places, but same effect. If you want to use Xcode we can get that working. Click the error in the top and let's see what it says and I'll help you from there. Or go into your project, hit target, go to build phases and send a screenshot of that. Also send a screenshot of your Scheme setup if you want to use Xcode - It can work just fine :)
 
It'd be easier but you don't *need* to. I've set up an Xcode project for Python before answering your initial post and it works just fine, minus some quirks. I basically did the same as the guide but slightly different in places, but same effect. If you want to use Xcode we can get that working. Click the error in the top and let's see what it says and I'll help you from there. Or go into your project, hit target, go to build phases and send a screenshot of that. Also send a screenshot of your Scheme setup if you want to use Xcode - It can work just fine :)
Hey, thank you for your kind gesture, I was able to run python on Xcode by revisiting all the steps :)
 
  • Like
Reactions: casperes1996
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.