tuist icon indicating copy to clipboard operation
tuist copied to clipboard

`tuist init` Fails on Case-Sensitive File Systems

Open bc-lee opened this issue 1 year ago • 5 comments

What happened?

I attempted to use Tuist's template to create a project, but the process failed. Based on my research, it seems that some logic for determining the project root or template root doesn't work properly on case-sensitive file systems.

My system is configured with a case-sensitive file system, as shown below:

$ diskutil apfs list | grep -C 2 /System/Volumes/Data
|   |   APFS Volume Disk (Role):   disk3s1 (Data)
|   |   Name:                      MacOS - Data (Case-sensitive)
|   |   Mount Point:               /System/Volumes/Data
|   |   Capacity Consumed:         884058738688 B (884.1 GB)
|   |   Sealed:

I suspect that the issue is related to the following file: RootDirectoryLocator.swift.

How do we reproduce it?

  1. Set up a case-sensitive file system and install Tuist on it. (A plain download from GitHub or using mise will suffice.)
  2. Run tuist init --platform ios in an empty directory.

Error log

Couldn't locate the root directory from path /path/to/mise/installs/tuist/4.37.0/bin/Templates/default. The root directory is the closest directory that contains a Tuist or a .git directory.
Consider creating an issue using the following link: https://github.com/tuist/tuist/issues/new/choose

macOS version

14.7.1

Tuist version

4.37.0

Xcode version

16.2

bc-lee avatar Dec 12 '24 03:12 bc-lee

Hey @bc-lee 👋, I'm here to help you with any issues you encounter with Tuist. Let's work together to solve this problem!

The issue you're encountering with tuist init on a case-sensitive file system might be related to how the RootDirectoryLocator.swift file determines the root directory. This file checks for the presence of a Tuist/ subdirectory, a Plugin.swift manifest, or a .git/ subdirectory to identify the root directory [1].

On case-sensitive file systems, discrepancies in case (e.g., Tuist vs. tuist) could lead to failures in locating these directories or files. Unfortunately, there is no specific documentation or known workaround for handling case-sensitive file systems in Tuist, as per the available information.

To address this issue, you might consider checking the case of the directory names and ensuring they match exactly as expected by the RootDirectoryLocator. If the problem persists, reviewing the implementation of RootDirectoryLocator.swift for any case sensitivity in file path comparisons might be necessary.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

dosubot[bot] avatar Dec 12 '24 03:12 dosubot[bot]

Hey @bc-lee 👋

Yes, you're most likely right. Would you be up to digging deeper? You can follow the docs for contributors here to run Tuist through Xcode. That way, you can add breakpoints and see where exactly things fail.

If you get stuck, I'd love to take a look and provide some extra pointers – however I'd rather not reconfigure my machine to be case sensitive 😅

fortmarek avatar Dec 16 '24 16:12 fortmarek

FYI: If you're using APFS volumes, you can create additional volumes to test both Case-Sensitive and Case-Insensitive file systems. I use this method to address issues with applications that require a case-insensitive file system. You can also test Tuist by creating a new volume with a case-sensitive file system, which improves compatibility with such configurations.

For more information, check out this link: https://support.apple.com/guide/disk-utility/dskua9e6a110/mac

Screenshot 2024-12-19 at 09 55 52

bc-lee avatar Dec 19 '24 01:12 bc-lee

Hi, just to add my two cents, I had the exact same problem when I installed [email protected] via homebrew. My filesystem is APFS case-insensitive.

I just removed it all from homebrew, and after reinstalling via mise started working fine 🤷‍♂️

The command I was running was tuist init --name MyAPP

EmranMR avatar Dec 31 '24 13:12 EmranMR

Hi there. I encountered a similar problem when installing with Homebrew. It's enough to simply call tuist scaffold list and get an error:

✖ Error Couldn't locate the root directory from path /usr/local/Cellar/[email protected]/4.50.2/share/Templates/default. The root directory is the closest directory that contains a Tuist or a .git directory.

In fact, there is no way to use even the default template. Therefore, neither tuist init nor tuist scaffold default will work.

The problem is solved by creating a .git folder, a Tuist.swift file, or by following any other condition described https://github.com/tuist/tuist/blob/f05ed90008a375c15cd1eec4bbac573d10a6e8c6/Sources/TuistCore/Utils/RootDirectoryLocator.swift#L69 It will also work if you create a .git folder in the share folder, or in the 4.50.2 folder (or whatever version of Tuist you have), or in the [email protected] folder, or in Cellar, and so on to the root.

It seems to me that the point is that RootDirectoryLocator is used, which is designed to search for the root folder of the project in which we want to call tuist generate and etc. But it doesn't have any conditions that the template must match.

null-z avatar Jun 01 '25 14:06 null-z