wojciech-kulik / xcodebuild.nvim

Neovim plugin to Build, Debug, and Test applications created for Apple devices (iOS, macOS, watchOS, etc.)
MIT License
552 stars 11 forks source link

Could not update Xcode project file. #87

Closed joeldrotleff closed 4 months ago

joeldrotleff commented 4 months ago

I tried a few times to add or remove files in nvim-tree, and I get an error Could not update Xcode project file.

In the error log I see:

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- xcodeproj (LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/joel/.local/share/nvim/lazy/xcodebuild.nvim/tools/project_helper.rb:3:in `<main>'

I used Lazy to install:

  {
    "wojciech-kulik/xcodebuild.nvim",
    lazy = false,
    dependencies = {
      "nvim-telescope/telescope.nvim",
      "MunifTanjim/nui.nvim",
      "nvim-tree/nvim-tree.lua", -- if you want the integration with file tree
    },
    config = function()
      require("xcodebuild").setup {
        -- put some options here or leave it empty to use default settings
      }
    end,
  },

And my Neovim setup is using NVChad (which installed nvim-tree itself), like this:

  {
    "nvim-tree/nvim-tree.lua",
    cmd = { "NvimTreeToggle", "NvimTreeFocus" },
    init = function()
      require("core.utils").load_mappings "nvimtree"
    end,
    opts = function()
      return require "plugins.configs.nvimtree"
    end,
    config = function(_, opts)
      dofile(vim.g.base46_cache .. "nvimtree")
      require("nvim-tree").setup(opts)
    end,
  },

Here's the config NVChad uses for nvim-tree:

local options = {
  filters = {
    dotfiles = false,
    exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
  },
  disable_netrw = true,
  hijack_netrw = true,
  hijack_cursor = true,
  hijack_unnamed_buffer_when_opening = false,
  sync_root_with_cwd = true,
  update_focused_file = {
    enable = true,
    update_root = false,
  },
  view = {
    adaptive_size = false,
    side = "left",
    width = 30,
    preserve_window_proportions = true,
  },
  git = {
    enable = false,
    ignore = true,
  },
  filesystem_watchers = {
    enable = true,
  },
  actions = {
    open_file = {
      resize_window = true,
    },
  },
  renderer = {
    root_folder_label = false,
    highlight_git = false,
    highlight_opened_files = "none",

    indent_markers = {
      enable = false,
    },

    icons = {
      show = {
        file = true,
        folder = true,
        folder_arrow = true,
        git = false,
      },

      glyphs = {
        default = "󰈚",
        symlink = "",
        folder = {
          default = "",
          empty = "",
          empty_open = "",
          open = "",
          symlink = "",
          symlink_open = "",
          arrow_open = "",
          arrow_closed = "",
        },
        git = {
          unstaged = "✗",
          staged = "✓",
          unmerged = "",
          renamed = "➜",
          untracked = "★",
          deleted = "",
          ignored = "◌",
        },
      },
    },
  },
}

return options
wojciech-kulik commented 4 months ago

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- xcodeproj (LoadError)

It indicates that you are missing CocoaPods/Xcodeproj. Please install all required dependencies:

brew install xcode-build-server
brew install xcbeautify
gem install xcodeproj
python3 -m pip install -U pymobiledevice3

and also please check the results of :checkhealth xcodebuild (zR to unfold)

Additionally, I noticed that you are using old Ruby (2.6.0) so it's also worth updating it.

joeldrotleff commented 4 months ago

Ah, never mind - I just needed to install xcodegen tool with sudo gem install xcodeproj. Now it works great!

wojciech-kulik commented 4 months ago

🎊 make sure to update Ruby, the minimum required version is (I believe) 2.7.0.

brew install ruby