Skip to content

Uv not getting installed during setup on macos #476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NoeFabris
Copy link

@NoeFabris NoeFabris commented Jul 31, 2025

Pull Request Title

Improving setup script to install uv on macos with homebrew

Related Issue

#475

Description

if macos added the installation script for uv using homebrew

Type

  • Bug Fix
  • Feature Enhancement
  • Documentation Update
  • Code Refactoring
  • Other (please specify):

Proposed Changes

use homebrew to install uv on mac

Screenshots / Code Snippets (if applicable)

ensure uv

if ! command -v uv &> /dev/null; then
info "uv not found; installing…"
if [[ "$OS_TYPE" == "macOS" ]]; then
brew install uv || error "Failed to install uv via Homebrew"
else
curl -LsSf https://astral.sh/uv/install.sh | sh || error "Failed to install uv"
export PATH="$HOME/.local/bin:$PATH"
fi
success "uv installed"
fi
check_cmd uv
success "All prerequisites satisfied."

How to Test

  1. run the setup script on a macos laptop that doesn't have uv already installed
  2. start the project
  3. upload the PDF
  4. at the moment it gives error because uv is missing, after running the updated script everything works.

Checklist

  • [ x] The code compiles successfully without any errors or warnings
  • [ x] The changes have been tested and verified
  • [ x] The documentation has been updated (if applicable)
  • [ x] The changes follow the project's coding guidelines and best practices
  • [ x] The commit messages are descriptive and follow the project's guidelines
  • [ x] All tests (if applicable) pass successfully
  • [ x] This pull request has been linked to the related issue (if applicable)

Additional Information


Summary by cubic

Fixed the setup script so that uv is installed on macOS using Homebrew if it is missing.

Summary by CodeRabbit

  • Chores
    • Improved installation process for the uv tool with OS-specific handling, using Homebrew on macOS and curl-based installation on other systems.
    • Added clearer success and error messages during installation.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

2 issues found across 1 file • Review in cubic

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

if [[ "$OS_TYPE" == "macOS" ]]; then
brew install uv || error "Failed to install uv via Homebrew"
else
curl -LsSf https://astral.sh/uv/install.sh | sh || error "Failed to install uv"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Piping a remotely fetched script directly into sh is insecure; download the installer to a file, verify its integrity, then execute it instead. (Based on previous feedback about avoiding curl | sh patterns in production scripts.)

Prompt for AI agents
Address the following comment on setup.sh at line 106:

<comment>Piping a remotely fetched script directly into `sh` is insecure; download the installer to a file, verify its integrity, then execute it instead. (Based on previous feedback about avoiding `curl | sh` patterns in production scripts.)</comment>

<file context>
@@ -99,9 +99,14 @@ success &quot;pip3 is available&quot;
 
 # ensure uv
 if ! command -v uv &amp;&gt; /dev/null; then
-  info &quot;uv not found; installing via Astral.sh…&quot;
-  curl -LsSf https://astral.sh/uv/install.sh | sh
-  export PATH=&quot;$HOME/.local/bin:$PATH&quot;
+  info &quot;uv not found; installing…&quot;
+  if [[ &quot;$OS_TYPE&quot; == &quot;macOS&quot; ]]; then
+    brew install uv || error &quot;Failed to install uv via Homebrew&quot;
</file context>

export PATH="$HOME/.local/bin:$PATH"
info "uv not found; installing…"
if [[ "$OS_TYPE" == "macOS" ]]; then
brew install uv || error "Failed to install uv via Homebrew"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brew is invoked without first verifying that Homebrew is installed, so the script will crash with an unclear error on macOS systems that lack Homebrew. Add an explicit command -v brew check or install instructions before calling brew. (Based on your team's feedback about making setup scripts resilient to missing dependencies.)

Prompt for AI agents
Address the following comment on setup.sh at line 104:

<comment>brew is invoked without first verifying that Homebrew is installed, so the script will crash with an unclear error on macOS systems that lack Homebrew.  Add an explicit `command -v brew` check or install instructions before calling brew. (Based on your team&#39;s feedback about making setup scripts resilient to missing dependencies.)</comment>

<file context>
@@ -99,9 +99,14 @@ success &quot;pip3 is available&quot;
 
 # ensure uv
 if ! command -v uv &amp;&gt; /dev/null; then
-  info &quot;uv not found; installing via Astral.sh…&quot;
-  curl -LsSf https://astral.sh/uv/install.sh | sh
-  export PATH=&quot;$HOME/.local/bin:$PATH&quot;
+  info &quot;uv not found; installing…&quot;
+  if [[ &quot;$OS_TYPE&quot; == &quot;macOS&quot; ]]; then
+    brew install uv || error &quot;Failed to install uv via Homebrew&quot;
</file context>

Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

The setup.sh script was updated to enhance the installation logic for the uv tool. The script now detects if it is running on macOS and uses Homebrew for installation; otherwise, it defaults to the previous curl-based method. Success and error messages were adjusted accordingly.

Changes

Cohort / File(s) Change Summary
Script OS-specific Installation
setup.sh
Added OS detection for uv installation. Uses Homebrew on macOS; retains curl install for others. Adjusted messaging.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~6 minutes

Poem

A bunny hops with bashful glee,
Now uv installs more cleverly!
On Mac it brews, on others curls,
Adapting well for all the worlds.
With scripts refined and logic neat,
This change makes setup extra sweet!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2ed00b and 3a5ad2c.

📒 Files selected for processing (1)
  • setup.sh (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: srbhr
PR: srbhr/Resume-Matcher#396
File: setup.ps1:152-155
Timestamp: 2025-07-21T04:13:08.518Z
Learning: Astral UV's official Windows installation method uses `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"` which directly executes a remote script. This is their recommended approach and should be followed in setup scripts.
Learnt from: srbhr
PR: srbhr/Resume-Matcher#396
File: setup.ps1:152-155
Timestamp: 2025-07-21T04:13:08.518Z
Learning: Astral UV's official Windows installation method uses `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"` which directly executes a remote script. This is their recommended approach per official documentation and should be followed in setup scripts rather than implementing custom download-then-execute patterns.
setup.sh (3)

Learnt from: srbhr
PR: #396
File: setup.ps1:152-155
Timestamp: 2025-07-21T04:13:08.518Z
Learning: Astral UV's official Windows installation method uses powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" which directly executes a remote script. This is their recommended approach and should be followed in setup scripts.

Learnt from: srbhr
PR: #396
File: setup.ps1:152-155
Timestamp: 2025-07-21T04:13:08.518Z
Learning: Astral UV's official Windows installation method uses powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" which directly executes a remote script. This is their recommended approach per official documentation and should be followed in setup scripts rather than implementing custom download-then-execute patterns.

Learnt from: elliotclee
PR: #457
File: setup.sh:168-180
Timestamp: 2025-07-28T19:07:07.416Z
Learning: elliotclee prefers simpler code over defensive programming in setup script contexts where .env files are considered trustworthy sources, and views additional security measures as unnecessary complexity when the trust boundary is already established.

🔇 Additional comments (1)
setup.sh (1)

100-110: OS-specific branch is a nice improvement.

Introducing a macOS branch resolves the original issue where uv wasn’t installed on macOS—good catch.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant